I am setting up Jest in my project to write unit test cases. When I run npm test I am faced with an error. I have configured Babel but the error still pops up.
Here is the Babel and Jest config. I have added them in the package.json file:
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.js$": "babel-jest"
}
},
"babel": {
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }]
]
},
Here is the full error:
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
export * from "./abstractScene.js";
^^^^^^SyntaxError: Unexpected token 'export'