-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
105 lines (87 loc) · 2.31 KB
/
Copy pathjest.config.js
File metadata and controls
105 lines (87 loc) · 2.31 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
// Enhanced performance optimizations
maxWorkers: process.env.CI ? 2 : '75%', // More workers locally, fewer in CI
cache: true,
cacheDirectory: '<rootDir>/node_modules/.cache/jest',
// Faster test discovery
haste: {
computeSha1: false,
throwOnModuleCollision: false,
},
// Test file patterns
testMatch: [
'<rootDir>/tests/**/*.test.ts',
'<rootDir>/tests/**/*.spec.ts'
],
// Module path mapping
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
// Setup files
setupFilesAfterEnv: [
'<rootDir>/tests/setup/jest.setup.ts'
],
// Coverage configuration (disable during development)
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/**/index.ts'
],
coverageReporters: [
'text-summary', // Faster than full text
'lcov'
],
coverageDirectory: 'coverage',
// Enhanced transform configuration with performance optimizations
transform: {
'^.+\\.ts$': ['ts-jest', {
tsconfig: 'tsconfig.test.json',
isolatedModules: true,
useESM: false,
// Skip type checking for faster compilation
diagnostics: false, // Completely disable diagnostics for speed
// Disable source maps for faster execution
sourcemap: false,
// Use faster compiler options
compilerOptions: {
skipLibCheck: true,
skipDefaultLibCheck: true,
}
}]
},
// Transform ignore patterns
transformIgnorePatterns: [
'node_modules/(?!(some-es6-module)/)'
],
// Module file extensions
moduleFileExtensions: [
'ts',
'js',
'json'
],
// Clear mocks between tests
clearMocks: true,
// Reduce verbosity for faster execution
verbose: false,
silent: false,
// Optimized timeout settings
testTimeout: 5000, // Reduced from 10 seconds to 5 seconds
// Performance settings
detectOpenHandles: false,
forceExit: true, // Enable for faster exit
// Bail early on failures (for faster feedback during development)
bail: false,
// Faster test running options
passWithNoTests: true,
errorOnDeprecated: false,
// Optimize watch mode
watchPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/',
'/.git/'
]
};