Im using JEST to test my app. But Im getting an error from the test file --
import xyz from './XYZ.js';
^^^^^^
SyntaxError: Unexpected token import
Then I created a .babelrc file and it has the following code --
{
"presets": [
"es2015"
]
}
After this, whichever file I have imported in the test file does not throw this error. But if one of the imported files (like XYZ.js) have import statement in itself, then it gives the same error on that file.
My package.json devDependencies (significant packages) --
"devDependencies": {
"babel-jest": "^19.0.0",
"babel-preset-es2015": "^6.22.0",
"eslint": "2.0.0",
"eslint-plugin-react": "latest",
"express": "^4.12.2",
"jest": "^19.0.1",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-router": "^2.8.1"
},
Can anyone point out what I have missed?