-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjest.config.js
50 lines (42 loc) · 1.18 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
40
41
42
43
44
45
46
47
48
49
50
/** @type {import("ts-jest/dist/types").InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
// The root of your source code
roots: [ "<rootDir>/src" ],
// Target test tsconfig
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json",
"useESM": true
}
},
// Jest transformations -- this adds support for TypeScript using ts-jest
transform: {
"^.+\\.tsx?$": "ts-jest"
},
// Test spec file resolution pattern
// Matches parent folder `__tests__` and filename should contain `test` or `spec`.
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
// Minimum coverage thresholds
// TODO : Increase threshold after implementing tests
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0
}
},
// Module file extensions for importing
moduleFileExtensions: [ "ts", "tsx", "js", "jsx", "json", "node" ],
extensionsToTreatAsEsm: [ ".ts", ".tsx" ],
// Webpack alias config=
moduleNameMapper: {
"^@src/(.*)$": "<rootDir>/src/$1"
},
// Setup scripts before tests
setupFilesAfterEnv: [
"<rootDir>/test/setup.test.ts"
]
};