-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
76 lines (61 loc) · 1.8 KB
/
jest.config.js
File metadata and controls
76 lines (61 loc) · 1.8 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
75
76
/** @type {import('jest').Config} */
module.exports = {
// Use ts-jest preset for TypeScript support
preset: 'ts-jest',
// Use Node.js environment (not browser)
testEnvironment: 'node',
// Test file locations
roots: ['<rootDir>/src', '<rootDir>/tests'],
// Test file patterns
testMatch: [
'**/__tests__/**/*.ts',
'**/?(*.)+(spec|test).ts'
],
// Coverage collection
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/index.ts', // Entry point, tested via integration
],
// Coverage thresholds (can adjust these as you improve coverage)
coverageThreshold: {
global: {
branches: 50, // Start with 50%, increase to 70% over time
functions: 60, // Start with 60%, increase to 80% over time
lines: 60, // Start with 60%, increase to 80% over time
statements: 60, // Start with 60%, increase to 80% over time
},
},
// Coverage output directory
coverageDirectory: 'coverage',
// Coverage reporters
coverageReporters: ['text', 'lcov', 'html'],
// Module name mapper for absolute imports (if needed)
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
// Transform TypeScript files
transform: {
'^.+\\.ts$': ['ts-jest', {
isolatedModules: true, // Disable type checking
diagnostics: false, // Disable TypeScript diagnostics
}],
},
// Setup files to run before tests
// setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/lib/',
'/build/',
],
// Global timeout for tests (30 seconds)
testTimeout: 30000,
// Verbose output
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Restore mocks between tests
restoreMocks: true,
};