vue3 + element-plus jest jest命令正常 jest --coverage报错?
jest命令正常 jest --coverage报错
Identifier '_interopRequireDefault' has already been declared. (133:9)
131 | var _FPLogo = _interopRequireDefault(require("@/assets/logo-02.jpg"));
132 |
133 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
| ^
134 |
135 | const _hoisted_1 = {
136 | class: "login-container columnCC",
jest.config
module.exports = { moduleFileExtensions: [
'ts',
'js',
'jsx',
'tsx',
'json',
// tell Jest to handle *.vue files
'vue'
],
// setupFiles: ['./__tests__/setup.js'],
transform: {
// process *.vue files with vue-jest
'^.+\\.vue$': require.resolve('vue-jest'),
'^.+\\.tsx?$': require.resolve('ts-jest'),
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
require.resolve('jest-transform-stub'),
'^.+\\.jsx?$': require.resolve('babel-jest')
},
transformIgnorePatterns: ['/node_modules/'],
// support the same @ -> src alias mapping in source code
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
// testEnvironment: 'jest-environment-jsdom-fifteen',
// serializer for snapshots
snapshotSerializers: ['jest-serializer-vue'],
testMatch: [
'**/tests/unit/**/*.spec.[jt]s?(x)',
'**/__tests__/*.[jt]s?(x)',
'**/__tests__/**/*.spec.[jt]s?(x)',
],
// https://github.com/facebook/jest/issues/6766
testURL: 'http://localhost/'
}
.babelrc
{ "presets": [
"@vue/babel-preset-jsx",
"babel-preset-vite"
,
"@babel/preset-env"
]
}
以上是 vue3 + element-plus jest jest命令正常 jest --coverage报错? 的全部内容, 来源链接: utcz.com/p/937394.html