-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
43 lines (42 loc) · 1.53 KB
/
jest.config.js
File metadata and controls
43 lines (42 loc) · 1.53 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
/** @type {import('jest').Config} */
const config = {
testEnvironment: 'node',
projects: [
{
displayName: 'unit',
testMatch: ['**/src/**/__tests__/**/*.test.js'],
setupFiles: ['<rootDir>/tests/setupTests.js'],
// coverageDirectory: '<rootDir>/coverage/unit',
restoreMocks: true, // Add this to restore mocks automatically after each test
resetMocks: false, // Don't reset mocks between tests, but restore their implementation
},
{
displayName: 'integration',
testMatch: ['**/tests/integration/**/*.test.js'],
setupFiles: ['<rootDir>/tests/integrationSetup.js'],
// coverageDirectory: '<rootDir>/coverage/integration',
restoreMocks: true, // Add this to restore mocks automatically after each test
resetMocks: false, // Don't reset mocks between tests, but restore their implementation
},
],
// Common configuration for all test types
globalTeardown: '<rootDir>/tests/globalTeardown.js',
collectCoverage: true,
coverageDirectory: '<rootDir>/coverage',
coverageThreshold: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
},
},
clearMocks: true,
restoreMocks: true, // Global setting as a fallback
detectOpenHandles: true,
forceExit: true,
verbose: true,
injectGlobals: true,
testTimeout: 30000, // Global timeout setting
};
module.exports = config;