-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.js
More file actions
54 lines (54 loc) · 1.94 KB
/
jest.config.js
File metadata and controls
54 lines (54 loc) · 1.94 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
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
testPathIgnorePatterns: ['/node_modules/', '/tests/ee/'],
transform: {
// Fix @swc/jest bug: const __dirname in ESM -> CJS conflicts with CJS wrapper param
'node_modules/@probelabs/probe/.+\\.js$': '<rootDir>/tests/transforms/probe-esm-fix.js',
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
},
target: 'es2022',
},
module: {
type: 'commonjs',
},
},
],
},
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
],
moduleNameMapper: {
'^@octokit/auth-app$': '<rootDir>/__mocks__/@octokit/auth-app.ts',
'^@octokit/rest$': '<rootDir>/__mocks__/@octokit/rest.ts',
'^@probelabs/probe$': '<rootDir>/__mocks__/@probelabs/probe.ts',
'^@utcp/sdk$': '<rootDir>/__mocks__/@utcp/sdk.ts',
'^@utcp/http$': '<rootDir>/__mocks__/@utcp/http.ts',
'^@utcp/file$': '<rootDir>/__mocks__/@utcp/file.ts',
'^open$': '<rootDir>/__mocks__/open.ts',
},
transformIgnorePatterns: [
'node_modules/(?!(@octokit|@actions|@kie|@probelabs|open)/)',
],
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
// Log per-test heap usage in CI (or when explicitly enabled)
logHeapUsage: process.env.CI === 'true' || process.env.VISOR_LOG_HEAP === 'true',
testTimeout: 10000, // Reduced from 30s to 10s for faster CI
// Prevent Jest from hanging on async operations
forceExit: true,
detectOpenHandles: process.env.CI ? false : true,
// Speed up test execution
maxWorkers: process.env.CI ? 1 : '50%',
// Use child processes on CI for better memory reclamation
workerThreads: process.env.CI ? false : true,
// Recycle workers if they retain too much memory
workerIdleMemoryLimit: process.env.CI ? '256MB' : undefined,
};