-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
30 lines (30 loc) · 956 Bytes
/
jest.config.js
File metadata and controls
30 lines (30 loc) · 956 Bytes
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
//const { compilerOptions } = require('./tsconfig.json');
//const { pathsToModuleNameMapper } = require('ts-jest');
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverageFrom: [
"src/**",
"!**/packer/**",
"!**/src/utils.ts",
"!**/src/index.bin.ts",
"!**/src/types/**",
"!**/src/Observer/**",
],
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
// 配置jest使用tsconfig.json中的path; 注意 tsconfig.json中不能有注释
// 参考 https://stackoverflow.com/questions/52860868/typescript-paths-not-resolving-when-running-jest
// moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};