-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
91 lines (70 loc) · 2.38 KB
/
Copy pathjest.config.js
File metadata and controls
91 lines (70 loc) · 2.38 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
/** @type {import('jest').Config} */
module.exports = {
// Use ts-jest preset for TypeScript support
preset: 'ts-jest',
// Test environment
testEnvironment: 'jsdom',
// Root directories for tests
roots: ['<rootDir>/tests', '<rootDir>/src'],
// Test file patterns
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/*.(test|spec).+(ts|tsx|js)'
],
// Transform files with ts-jest
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: 'tsconfig.test.json'
}]
},
// Don't ignore jimp in node_modules - it needs to be transformed
transformIgnorePatterns: [
'node_modules/(?!(jimp))'
],
// Module file extensions
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
// Coverage settings
collectCoverage: false, // Set to true to enable coverage by default
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'clover'],
// Coverage paths
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.test.{ts,tsx}',
'!src/**/*.spec.{ts,tsx}'
],
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup/jest.setup.ts'],
// Module name mapping for imports
moduleNameMapper: {
'^serialport$': '<rootDir>/tests/__mocks__/serialport.js',
'^jimp$': '<rootDir>/tests/mocks/jimp.mock.js',
'^@/(.*)$': '<rootDir>/src/$1'
},
// Clear mocks between tests
clearMocks: true,
// Verbose output
verbose: true,
// Timeout for tests (30 seconds)
testTimeout: 30000,
// Recycle a worker once its heap grows past this, so a heavy file (e.g. SPECTRO's
// 62 windows of FFT buffers) can't accumulate memory across files and flake a
// later test under parallel load. Applies to every parallel run; the check-in
// runner (run_tests_parallel.sh) also passes this explicitly.
workerIdleMemoryLimit: '512MB',
// Resource Management Options (commented out by default)
// Uncomment the options below to throttle test execution:
// Run tests sequentially to reduce resource usage
// maxWorkers: 1,
// Use 50% of available CPU cores
// maxWorkers: "50%",
// Detect open handles (helps identify resource leaks)
// detectOpenHandles: true,
// Force exit after tests complete
// forceExit: true,
// Bail after first test failure (speeds up feedback)
// bail: 1,
// Limit concurrent test files
// maxConcurrency: 5
};