-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.js
102 lines (102 loc) · 4.52 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['/node_modules/'],
coverageProvider: 'v8',
maxWorkers: "50%",
projects: [
{
displayName: { name: 'api', color: 'yellow' },
clearMocks: true,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'^actions/(.*)$': '<rootDir>/src/actions/$1',
'^api/(.*)$': '<rootDir>/src/app/api/$1',
'^components/(.*)$': '<rootDir>/src/components/$1',
'^environment/(.*)$': '<rootDir>/src/environments/$1',
'^lib/(.*)$': '<rootDir>/src/lib/$1',
'^services/(.*)$': '<rootDir>/src/services/$1',
'^tests/(.*)$': '<rootDir>/tests/$1',
},
modulePaths: ['<rootDir>/src/'],
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/jest.setup.backend.ts'],
testEnvironment: 'node',
testMatch: ['<rootDir>/**/api/**/*.test.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.jest.json' }],
"_^.+\\.jsx?$": '@swc-node/jest',
get "^.+\\.jsx?$"() {
return this["_^.+\\.jsx?$"];
},
set "^.+\\.jsx?$"(value) {
this["_^.+\\.jsx?$"] = value;
},
'^.+\\.css$': 'jest-css-modules-transform',
},
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
},
{
displayName: { name: 'services', color: 'magenta' },
clearMocks: true,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'^actions/(.*)$': '<rootDir>/src/actions/$1',
'^api/(.*)$': '<rootDir>/src/app/api/$1',
'^components/(.*)$': '<rootDir>/src/components/$1',
'^environment/(.*)$': '<rootDir>/src/environments/$1',
'^lib/(.*)$': '<rootDir>/src/lib/$1',
'^services/(.*)$': '<rootDir>/src/services/$1',
'^tests/(.*)$': '<rootDir>/tests/$1',
},
modulePaths: ['<rootDir>/src/'],
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/jest.setup.backend.ts'],
testEnvironment: 'node',
testMatch: ['<rootDir>/**/services/**/*.test.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.jest.json' }],
"_^.+\\.jsx?$": '@swc-node/jest',
get "^.+\\.jsx?$"() {
return this["_^.+\\.jsx?$"];
},
set "^.+\\.jsx?$"(value) {
this["_^.+\\.jsx?$"] = value;
},
'^.+\\.css$': 'jest-css-modules-transform',
},
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
},
{
displayName: { name: 'components', color: 'blue' },
clearMocks: true,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'^actions/(.*)$': '<rootDir>/src/actions/$1',
'^api/(.*)$': '<rootDir>/src/app/api/$1',
'^components/(.*)$': '<rootDir>/src/components/$1',
'^environment/(.*)$': '<rootDir>/src/environments/$1',
'^lib/(.*)$': '<rootDir>/src/lib/$1',
'^services/(.*)$': '<rootDir>/src/services/$1',
'^tests/(.*)$': '<rootDir>/tests/$1',
},
modulePaths: ['<rootDir>/src/'],
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/jest.setup.frontend.ts'],
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/tests/components/**/*.test.tsx'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.jest.json' }],
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel-jest.config.js' }],
'^.+\\.css$': 'jest-css-modules-transform',
},
transformIgnorePatterns: [
"node_modules/(?!(nanostores|better-auth)/)",
],
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
},
],
};