-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
78 lines (69 loc) · 1.75 KB
/
jest.config.js
File metadata and controls
78 lines (69 loc) · 1.75 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
73
74
75
76
77
78
/** @type {import('jest').Config} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
// Test file patterns
testMatch: [
'**/tests/**/*.test.ts',
'**/tests/**/*.spec.ts',
],
// Coverage configuration
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/cli/index.ts', // Main entry point
'!src/cli/commands/translate/index.ts', // Barrel re-exports
'!src/types/**/*.ts', // Type definitions
'!src/version.ts', // Mocked in tests (uses import.meta.url)
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html', 'cobertura'],
coverageThreshold: {
global: {
branches: 86,
functions: 94,
lines: 93,
statements: 93,
},
},
// Module resolution
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'(.*)/version\\.js$': '<rootDir>/tests/__mocks__/version',
'^(\\.{1,2}/.*)\\.js$': '$1',
},
// Transform configuration
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: {
// Relaxed settings for tests
strict: true,
esModuleInterop: true,
skipLibCheck: true,
},
}],
'^.+\\.jsx?$': ['ts-jest', {
tsconfig: {
strict: true,
esModuleInterop: true,
skipLibCheck: true,
allowJs: true,
},
}],
},
// Transform ESM packages
transformIgnorePatterns: [
'node_modules/(?!(p-limit|yocto-queue|fast-glob|chalk|chokidar|readdirp)/)',
],
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
// Test timeout
testTimeout: 10000,
// Clear mocks between tests
clearMocks: true,
resetMocks: true,
restoreMocks: true,
// Verbose output
verbose: true,
};