Found this issue with Jest and babel 7
babel-jest does not transpile import/export in node_modules when Babel 7 is used
Found this issue with Jest and babel 7
babel-jest does not transpile import/export in node_modules when Babel 7 is used
What worked for me was adding
"transformIgnorePatterns": [
"node_modules/core-js",
"node_modules/babel-runtime",
"node_modules/lodash",
"node_modules/vue"
],
to my jest config
Full config:
{
"moduleFileExtensions": [
"js",
"vue"
],
"collectCoverageFrom": [
"**/*.{vue}"
],
"transformIgnorePatterns": [
"node_modules/core-js",
"node_modules/babel-runtime",
"node_modules/lodash",
"node_modules/vue"
],
"moduleNameMapper": {
"quasar": "<rootDir>/node_modules/quasar-framework",
"^src/(.*)$": "<rootDir>/src/$1",
"^assets/(.*)$": "<rootDir>/src/assets/$1",
"^@/(.*)$": "<rootDir>/src/components/$1",
"^variables/(.*)$": "<rootDir>/src/themes/quasar.variables.sty/$1"
},
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
"mapCoverage": true
}
.babelrc
{
"presets": [["es2015", {"modules": false}], "stage-2"],
"plugins": ["transform-runtime"],
"comments": false,
"env": {
"test": {
"plugins": [
"transform-es2015-modules-commonjs"
]
}
}
}
installed extra packages: