forked from CalloraOrg/Callora-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.cjs
More file actions
34 lines (34 loc) · 1.05 KB
/
Copy pathjest.config.cjs
File metadata and controls
34 lines (34 loc) · 1.05 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
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).ts'],
// Exclude tests that use Node.js native test runner
testPathIgnorePatterns: ['/node_modules/', 'event.emitter.test.ts'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: {
'^(.*/)?generated/prisma/client(\\.js)?$': '<rootDir>/src/test-support/prismaClient.jest.ts',
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.ts$': [
'ts-jest',
{
useESM: false,
tsconfig: {
module: 'commonjs',
moduleResolution: 'node',
isolatedModules: true,
},
},
],
},
// Parallel execution settings
maxWorkers: '50%', // Use 50% of available CPU cores
// Ensure proper cleanup between tests
clearMocks: true,
resetMocks: false,
restoreMocks: true,
// Isolate modules between test files to prevent shared state
resetModules: false, // Keep false to avoid performance hit, rely on proper cleanup
};