-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
Version
2.0.0-beta.10
Environment
"vue": "^3.0.2"
Reproduction link
Steps to reproduce
- Create a project with the newest @vue/cli
- Create a random single file component and use there a random component from ant-design-vue
- Try to write a test
- The output will be something like:
Test suite failed to run
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import baseGetTag from './_baseGetTag.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 Object. (node_modules/ant-design-vue/lib/_util/props-util/index.js:27:45)
What is expected?
Unit tests should run as usual
What is actually happening?
Jest can't resolve ant-design-vue
package.json:
"dependencies": {
"ant-design-vue": "^2.0.0-beta.10",
"axios": "^0.20.0",
"core-js": "^3.6.5",
"csv-parse": "^4.12.0",
"fs": "0.0.1-security",
"googleapis": "^61.0.0",
"readline": "^1.3.0",
"tailwindcss": "^1.9.3",
"vue": "^3.0.2",
"vue-i18n": "^9.0.0-beta.4",
"vue-router": "^4.0.0-0",
"vue-window-size": "^1.0.2"
},
"devDependencies": {
"@types/jest": "^24.0.19",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0-0",
"husky": "^4.3.0",
"lint-staged": "^9.5.0",
"node-sass": "^4.12.0",
"prettier": "^2.1.2",
"sass-loader": "^8.0.2",
"typescript": "~3.9.3",
"vue-cli-plugin-webpack-bundle-analyzer": "^2.0.0",
"vue-jest": "^5.0.0-alpha.5"
},
jest.config.js
module.exports = {
preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel",
transform: {
"^.+\\.vue$": "vue-jest",
},
};
babel.config.js
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
};