-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
71 lines (71 loc) · 1.91 KB
/
Copy pathjest.config.js
File metadata and controls
71 lines (71 loc) · 1.91 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
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/tests', '<rootDir>/src'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/*.(test|spec).+(ts|tsx|js)'
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.test.{ts,tsx}',
'!src/**/__tests__/**',
'!src/enhanced-cli.ts', // Exclude CLI entry point from coverage
'!src/cli.ts', // Exclude legacy CLI from coverage
'!src/stubs/**' // Exclude stub files
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testTimeout: 10000,
verbose: true,
clearMocks: true,
restoreMocks: true,
// Coverage thresholds for quality gates - lowered for CI stability
coverageThreshold: {
global: {
branches: 30, // Lowered for blessed.js and Commander.js type issues
functions: 30,
lines: 30,
statements: 30
}
},
// Module name mapping for easier imports
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/'
],
watchPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/'
],
// Handle ES modules in node_modules - more permissive
transformIgnorePatterns: [
'node_modules/(?!(inquirer|chalk|ora|commander|blessed|figlet|gradient-string|fs-extra|axios)/)'
],
// Add extensionsToTreatAsEsm for better ES module support
extensionsToTreatAsEsm: ['.ts'],
// Add global setup for ES modules
globals: {
'ts-jest': {
useESM: true,
tsconfig: {
allowSyntheticDefaultImports: true,
esModuleInterop: true
}
}
},
// Extensions Jest will resolve
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
};