SyntaxError: Cannot use import statement outside a module
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
Throwing error when test cases executed with Jest + Enzyme library
You need to updated the babel.config.js file with the below code inside the plugins section
plugins: ["@babel/plugin-transform-modules-commonjs", {
"allowTopLevelThis": true
}]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.