-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
96 lines (83 loc) · 2.94 KB
/
Copy pathjest.config.js
File metadata and controls
96 lines (83 loc) · 2.94 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
module.exports = {
// Use ts-jest preset for TypeScript support
preset: 'ts-jest',
// Test environment
testEnvironment: 'node',
// Setup files
setupFilesAfterEnv: ['<rootDir>/src/test/setup.ts'],
// Test file patterns
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)'
],
// Module paths
moduleNameMapper: {
// ts-jest hands a stylesheet to the TypeScript parser, which dies on the first selector, so
// any component doing `import './Thing.css'` is unmountable without this.
'\\.(css|less|scss|sass)$': '<rootDir>/src/test/styleStub.js',
'^@/(.*)$': '<rootDir>/src/$1',
'^@api/(.*)$': '<rootDir>/src/api/$1',
'^@shell/(.*)$': '<rootDir>/src/shell/$1',
'^@main/(.*)$': '<rootDir>/src/main/$1',
'^@renderer/(.*)$': '<rootDir>/src/renderer/$1'
},
// Transform settings
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: {
jsx: 'react',
esModuleInterop: true
}
}]
},
// Coverage configuration
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/test/**/*',
'!src/**/__tests__/**/*',
'!src/**/index.ts'
],
// Coverage thresholds
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
// Coverage reporters
coverageReporters: ['text', 'lcov', 'html'],
// Git worktrees live in `<project>/.claude/` by project convention, which puts a
// second full copy of the repo INSIDE the repo. Without this, jest builds one
// module map across both copies, every package.json name collides, and suites fail
// in the MAIN tree as well — reporting failures that have nothing to do with the
// code under test. modulePathIgnorePatterns (not just testPathIgnorePatterns) is
// the one that keeps the copy out of the module map.
modulePathIgnorePatterns: ['<rootDir>/.claude/'],
// Ignore patterns
testPathIgnorePatterns: [
'/node_modules/',
// Worktrees — see modulePathIgnorePatterns above. MUST be <rootDir>-anchored:
// a bare '/\\.claude/' is matched against the ABSOLUTE path, so running jest
// from INSIDE a worktree (whose own path contains /.claude/) ignored every one
// of its tests and reported "No tests found". Anchored, it excludes a nested
// worktree when run from the main repo and excludes nothing when run from
// within the worktree itself, which is what both callers need.
'<rootDir>/\\.claude/',
'/dist/',
'/build/',
'/tests/e2e/',
'/terminal-monitor/',
'/mcp-server/', // MCP sidecar owns its own runner (`bun test`)
'/packages/', // Workspace packages own their own jest config (jsdom env)
'\\.spec\\.(js|ts)$' // Exclude Playwright spec files
],
// Module file extensions
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
// Timeouts
testTimeout: 10000,
// Verbose output
verbose: true
};