I am start test component React with Jest and Enzyme, so I can't run test success with issue import file.
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import './_rollupPluginBabelHelpers-3c58f0e3.js';
SyntaxError: Cannot use import statement outside a module
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at node_modules/react-imask/dist/react-imask.js:2:83
at Object.<anonymous> (node_modules/react-imask/dist/react-imask.js:5:2)
My package.json
{
"name": "my-app",
"version": "0.1.0",
"jest": {
"testResultsProcessor": "./node_modules/jest-junit-reporter",
"transformIgnorePatterns": "['node_modules/(?!(imask)/)']"
},
"private": true,
"dependencies": {
"@babel/runtime": "^7.12.5",
"@material-ui/core": "^4.11.0",
"@material-ui/data-grid": "^4.0.0-alpha.8",
"@material-ui/icons": "^4.9.1",
"@material-ui/pickers": "^4.0.0-alpha.12",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.1.2",
"@transwap/ui": "^2.0.1-rev182",
"axios": "^0.20.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"clsx": "^1.1.1",
"date-fns": "^2.16.1",
"formik": "2.1.4",
"html-react-parser": "^0.14.2",
"lodash": "^4.17.20",
"material-ui-popup-state": "^1.7.0",
"moment": "^2.29.1",
"node-sass": "^4.14.1",
"oidc-client": "^1.10.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-query": "^2.23.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"uuid": "^8.3.1",
"yup": "^0.29.1"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-transform-runtime": "^7.12.10",
"axios-mock-adapter": "^1.18.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"faker": "^5.1.0",
"jest-junit-reporter": "^1.1.0",
"moxios": "^0.4.0",
"prettier": "^2.1.2",
"react-app-rewired": "2.1.6"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.js",
"lint:fix": "eslint --fix src/**/*.js"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}