-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
87 lines (85 loc) · 1.99 KB
/
jest.config.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const tsconfig = require('./tsconfig.json');
const moduleNameMapper = require('tsconfig-paths-jest')(tsconfig);
const baseConfig = {
testEnvironment: 'node',
roots: ['<rootDir>/src'],
modulePaths: ['<rootDir>/src'],
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'ts', 'json', 'node'],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
decorators: false,
dynamicImport: true,
},
transform: null,
target: 'es2021',
loose: false,
externalHelpers: true,
keepClassNames: true,
},
},
],
},
moduleNameMapper,
};
/** @type {import('jest').Config} */
module.exports = {
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.ts',
'!**/database/migrations/**',
'!**/database/scripts/**',
'!src/index.ts',
'!src/**/__tests__/**',
'!src/fixtures/**',
],
coverageReporters: ['json-summary', 'lcov', 'json', 'text-summary'],
projects: [
{
...baseConfig,
displayName: 'unit-tests',
testMatch: ['<rootDir>/src/**/*.unit.test.ts'],
globals: {
IN_MEMORY: true,
},
},
{
...baseConfig,
displayName: 'service-tests',
testMatch: ['<rootDir>/src/**/*.service.test.ts'],
globals: {
IN_MEMORY: true,
},
},
{
...baseConfig,
displayName: 'acceptance-tests-in-memory',
testMatch: ['<rootDir>/src/**/*.acceptance.test.ts'],
globals: {
IN_MEMORY: true
},
},
{
...baseConfig,
displayName: 'acceptance-tests-prod-ready',
testMatch: ['<rootDir>/src/**/*.acceptance.test.ts'],
globals: {
IN_MEMORY: false,
},
},
{
...baseConfig,
displayName: 'integration-tests',
testMatch: ['<rootDir>/src/**/*.integration.test.ts'],
globals: {
IN_MEMORY: false,
},
},
],
};