-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.cjs
More file actions
72 lines (63 loc) · 1.66 KB
/
jest.config.cjs
File metadata and controls
72 lines (63 loc) · 1.66 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
62
63
64
65
66
67
68
69
70
71
72
/**
* @aido/api Jest 설정
*
* @aido/jest-config 프리셋을 확장하여 NestJS + SWC 환경에 최적화
*/
const preset = require('@aido/jest-config/jest.preset.cjs');
/** @type {import('jest').Config} */
module.exports = {
...preset,
// SWC로 변환 (ts-jest 대신, 더 빠름)
transform: {
'^.+\\.ts$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
decorators: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
},
target: 'es2022',
},
module: {
type: 'commonjs',
},
},
],
},
// 루트 디렉토리 - unit test는 src 내부에서만 실행
rootDir: '.',
roots: ['<rootDir>/src'],
// 테스트 패턴 - unit test만 (e2e, integration은 별도 설정)
testMatch: undefined,
testRegex: '.*\\.spec\\.ts$',
testPathIgnorePatterns: [
'/node_modules/',
'\\.e2e-spec\\.ts$',
'\\.integration-spec\\.ts$',
],
// 커버리지 설정
collectCoverageFrom: [
'src/**/*.(t|j)s',
'!src/**/*.spec.ts',
'!src/**/*.e2e-spec.ts',
'!src/**/*.integration-spec.ts',
],
coverageDirectory: './coverage',
// 타임아웃 (Testcontainers용)
testTimeout: 60000,
// Jest 전역 설정 파일
setupFilesAfterEnv: ['<rootDir>/test/setup/jest.setup.ts'],
// 모듈 별칭
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@test/(.*)$': '<rootDir>/test/$1',
'^@aido/validators$': '<rootDir>/../../packages/validators/src',
'^@aido/utils$': '<rootDir>/../../packages/utils/src',
'^(\\.{1,2}/.*)\\.js$': '$1',
},
};