-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.ts
More file actions
42 lines (31 loc) · 992 Bytes
/
jest.config.ts
File metadata and controls
42 lines (31 loc) · 992 Bytes
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
import type { Config } from 'jest';
const config: Config = {
// Extensions to look for
moduleFileExtensions: ['js', 'json', 'ts'],
// Root directory for test discovery
rootDir: 'src',
// Regex for test file names
testRegex: '.*\\.spec\\.ts$',
// Transform settings (using ts-jest for TypeScript files)
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
// Coverage settings
collectCoverage: true,
collectCoverageFrom: ['**/*.(t|j)s', '!main.ts', '!**/node_modules/**'],
coverageDirectory: '../coverage',
coverageReporters: ['json', 'lcov', 'text', 'clover'],
// Test environment
testEnvironment: 'node',
// Path aliasing support
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
},
// Automatically clear mock calls and instances between tests
clearMocks: true,
// Configure Jest to detect and handle TypeScript paths
modulePaths: ['<rootDir>'],
// Optional verbose output
verbose: true,
};
export default config;