-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
78 lines (65 loc) · 1.62 KB
/
jest.config.js
File metadata and controls
78 lines (65 loc) · 1.62 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 {
// Use ts-jest for TypeScript files
preset: 'ts-jest/presets/default-esm',
// Test environment
testEnvironment: 'node',
// Run tests serially to avoid credential file race conditions
// Tests that manipulate shared state (credentials.json) need serial execution
maxWorkers: 1,
// ESM support
extensionsToTreatAsEsm: ['.ts', '.tsx'],
// Module name mapping for ESM
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
// Transform configuration for ts-jest
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
tsconfig: 'tsconfig.json',
},
],
},
// Test file patterns
testMatch: [
'<rootDir>/src/**/__tests__/**/*.test.ts',
'<rootDir>/src/**/__tests__/**/*.test.tsx',
'<rootDir>/tests/**/*.test.ts',
'<rootDir>/tests/**/*.test.tsx',
],
// Coverage configuration
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
// Coverage thresholds (starting low, increase over time)
coverageThreshold: {
global: {
branches: 5,
functions: 5,
lines: 5,
statements: 5,
},
},
// Files to collect coverage from
collectCoverageFrom: [
'src/lib/**/*.ts',
'src/lib/**/*.tsx',
'!src/lib/**/*.d.ts',
'!src/**/__tests__/**',
'!src/**/index.ts',
],
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
],
// Clear mocks between tests
clearMocks: true,
// Verbose output
verbose: true,
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
};