-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.js
More file actions
74 lines (61 loc) · 1.62 KB
/
jest.config.js
File metadata and controls
74 lines (61 loc) · 1.62 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
module.exports = {
// Use ts-jest preset for TypeScript support
preset: "ts-jest",
// Set test environment to Node.js
testEnvironment: "node",
// Setup files to run after Jest environment is set up
setupFilesAfterEnv: ["<rootDir>/tests/setup/jest.setup.ts"],
// Test file patterns
testMatch: [
"<rootDir>/tests/**/*.test.ts",
"<rootDir>/tests/**/*.spec.ts",
"<rootDir>/tests/**/*.test.js",
"<rootDir>/tests/**/*.spec.js"
],
// Module name mapping for path aliases
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/api/$1",
"^@tests/(.*)$": "<rootDir>/tests/$1"
},
// Coverage configuration
collectCoverageFrom: [
"api/**/*.ts",
"!api/**/*.d.ts",
"!api/index.ts",
"!api/**/test_routes/**",
"!**/node_modules/**",
"!**/dist/**"
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
// Coverage reporters
coverageReporters: [
"text",
"text-summary",
"html",
"lcov"
],
// Coverage directory
coverageDirectory: "coverage",
// File extensions to consider
moduleFileExtensions: ["ts", "js", "json"],
// Ignore patterns
testPathIgnorePatterns: [
"/node_modules/",
"/dist/",
"/coverage/"
],
// Clear mocks between tests
clearMocks: true,
// Restore mocks after each test
restoreMocks: true,
// Timeout for tests (3 minutes)
testTimeout: 180000
};