-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Description
I'm trying to test a simple module, but I'm getting this error:
Test suite failed to run
/home/matheusml/Projects/react-completo/src/assets/images/dribble-logo.png:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){�PNG
^
SyntaxError: Invalid or unexpected token
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:320:12)
at Object.<anonymous> (src/components/container/Container.js:4:46)
at Object.<anonymous> (src/components/App.js:4:44)
This is the test:
import React from 'react';
import renderer from 'react-test-renderer';
import { Router } from 'react-router';
import App from './App';
test('App', () => {
const component = renderer.create(
<App />
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
This is my package.json:
"jest": {
"moduleNameMapper": {
"\\.(jpg|jpeg|png|svg)$": "./src/config/fileMock.js",
"\\.(css|scss)$": "identity-obj-proxy"
}
}
And this is the fileMock.js:
module.exports = 'test-file-stub';
Thanks!
yuripramos, pawarvijay, moppymopperson, slipperypenguin, alp82 and 79 more
Metadata
Metadata
Assignees
Labels
No labels