-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.js
39 lines (38 loc) · 1.07 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module.exports = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'jest-environment-jsdom-fifteen',
globals: {
__DEV__: true,
__TEST__: true,
__VERSION__: require('./package.json').version,
__BROWSER__: false,
__GLOBAL__: false,
__ESM_BUNDLER__: true,
__ESM_BROWSER__: false,
__NODE_JS__: true,
__FEATURE_OPTIONS__: true,
__FEATURE_SUSPENSE__: true,
},
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['html', 'lcov', 'text'],
collectCoverageFrom: [
'src/*.tsx',
'src/*.ts'
],
// watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'vue'],
transform: {
"^.+\\.[jt]sx?$": "babel-jest",
// 用 `vue-jest` 处理 `*.vue` 文件
"^.+\\.vue$": "vue-jest"
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
// "^vue$": "vue/dist/vue.common.js",
"\\.(css|less|scss|sss|styl)$": "<rootDir>/node_modules/jest-css-modules"
},
rootDir: __dirname,
transformIgnorePatterns: ['<rootDir>/node_modules/']
}