Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
45 lines (44 loc) · 1.68 KB
/
Copy pathvitest.config.mts
File metadata and controls
45 lines (44 loc) · 1.68 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
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'node',
env: { NODE9_TESTING: '1' },
// Each test file gets an empty HOME, so the developer's ~/.node9 never changes a result.
setupFiles: ['src/__tests__/helpers/isolate-home.ts'],
clearMocks: true,
// Integration tests spawn child processes via spawnSync (runCheck / runDoctor).
// On slow CI runners those can take 10-15s. The default 5s vitest timeout fires
// before the child process completes, causing false timeouts. 30s is generous
// enough for any CI machine while still catching genuinely hanging tests.
testTimeout: 30000,
// Claude Code worktrees (parallel agent sessions) are full repo copies
// inside the repo — without this, `npm test` runs THEIR suites too
// (~3x the tests) and their in-progress failures gate OUR commits.
exclude: ['**/node_modules/**', '**/dist/**', '.claude/worktrees/**'],
},
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
exclude: [
'src/**/__tests__/**',
'src/**/*.d.ts',
'src/daemon/ui.ts',
// Barrel file — no executable code, 0% is correct
'src/core.ts',
// OS-native UI — spawns zenity/osascript, untestable in CI
'src/ui/native.ts',
],
reporter: ['text', 'html', 'json-summary'],
reportsDirectory: './coverage',
all: true,
thresholds: {
// Floors raised on 2026-03-28 after adding auth/state, timeout-racer, and
// unknown-ID tests. CI blocks any regression below these numbers.
// Target: 80% across the board.
statements: 70,
branches: 60,
functions: 70,
lines: 71,
},
},
});