-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjest.config.cjs
More file actions
44 lines (43 loc) · 1.17 KB
/
Copy pathjest.config.cjs
File metadata and controls
44 lines (43 loc) · 1.17 KB
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
40
41
42
43
44
const tsJestOptions = {
diagnostics: { ignoreCodes: [1324, 151002] },
// Keep coverage mapped to TypeScript without changing the distribution build.
tsconfig: { sourceMap: true },
useESM: false,
};
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src'],
// Jest otherwise only measures files imported by tests, hiding untested handlers.
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/**/*.test.ts',
'!src/index.ts',
'!src/scripts/**',
'!src/testUtils/**',
],
// Keep roughly one percentage point of headroom for unrelated changes. Raise
// a floor after durable tests lift production coverage enough to retain it.
coverageThreshold: {
global: {
branches: 88,
functions: 91,
lines: 95.5,
statements: 94,
},
},
transform: {
'\\.[jt]sx?$': ['ts-jest', tsJestOptions],
},
transformIgnorePatterns: [
'node_modules[\\\\/](?!(@inquirer|fast-.+)[\\\\/])',
],
moduleNameMapper: {
'^(\\.\\.?\\/.+)\\.js$': '$1',
},
coveragePathIgnorePatterns: [
'[\\\\/]node_modules[\\\\/]',
'[\\\\/]src[\\\\/]index\\.ts$',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
};