-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
61 lines (60 loc) · 1.64 KB
/
jest.config.js
File metadata and controls
61 lines (60 loc) · 1.64 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
module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
testEnvironment: 'node',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: [
'src/**/*.(t|j)s',
'!src/**/*.spec.ts',
'!src/**/*.interface.ts',
'!src/**/*.dto.ts',
'!src/**/*.entity.ts',
'!src/main.ts',
],
coverageDirectory: './coverage',
coverageReporters: ['text', 'lcov', 'html'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
// Clean up after each test
clearMocks: true,
// Define projects for unit tests
projects: [
{
displayName: 'unit',
testMatch: ['<rootDir>/src/**/*.spec.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
testEnvironment: 'node',
testTimeout: 30000, // Changed from timeout to testTimeout
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
clearMocks: true,
},
{
displayName: 'integration',
testMatch: ['<rootDir>/src/**/*.e2e-spec.ts'],
setupFilesAfterEnv: ['<rootDir>/test/setup-e2e.ts'], // New setup file for e2e tests
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
testEnvironment: 'node',
testTimeout: 30000, // Added testTimeout
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
clearMocks: true,
},
],
};