Jest: ES6 import doesnt work in jest even after babel config, throws SyntaxError: Unexpected token export

Created on 7 Aug 2018  路  2Comments  路  Source: facebook/jest

馃悰 Bug Report

Added the dependencies

package.json
"devDependencies": {
"babel-core": "^7.0.0-0",
"babel-jest": "^23.4.2",
"babel-preset-env": "^1.7.0",
"jest": "^23.4.2",
"jest-cli": "^23.4.2",
"regenerator-runtime": "^0.12.1"
},

.babelrc
{
"presets": ["env"]
}

Still, when running the test SyntaxError: Unexpected token export

All 2 comments

You'll likely need to change .babelrc to babel.config.js: https://babeljs.io/docs/en/next/babelconfigjs.html and add @babel/core to deps. Please read docs carefully.

Also, this is not a help forum.

Tried this but it didn't solve the problem.

Was this page helpful?
0 / 5 - 0 ratings