-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
51 lines (46 loc) · 1.57 KB
/
Copy pathjest.config.js
File metadata and controls
51 lines (46 loc) · 1.57 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
/**
* @license
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2025-2026 Ryan Johnson
*
* Jest configuration optimized for memory usage and performance.
*/
module.exports = {
// Test configuration.
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
// Optimize for memory usage
maxWorkers: 1, // Run tests sequentially to reduce memory pressure.
forceExit: true, // Force exit the Jest process once all tests complete.
detectOpenHandles: true, // Detect open handles to prevent memory leaks.
testTimeout: 30000, // Longer timeout for network operations.
// Transform with ts-jest.
transform: {
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json', // Use test-specific tsconfig.
diagnostics: {
warnOnly: true, // Only warn on TS errors to reduce memory impact.
ignoreCodes: [
2571, // Object is of type 'unknown'.
6133, // Unused variable.
18003 // No inputs were found in config file.
]
}
}
]
},
// Reporting and coverage - disable by default for better performance.
// Enable explicitly with --coverage flag only when needed.
verbose: true,
coverageDirectory: './coverage/',
collectCoverage: process.env.COLLECT_COVERAGE === 'true',
collectCoverageFrom: ['src/**/*.ts', '!src/types.ts', '!src/constants.ts'],
// Setup for Node.js compatibility with @actions packages.
setupFilesAfterEnv: ['<rootDir>/jest.setup.js']
};