-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvitest.config.ts
More file actions
78 lines (74 loc) · 2.53 KB
/
vitest.config.ts
File metadata and controls
78 lines (74 loc) · 2.53 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
import { defineConfig, defineProject } from "vitest/config";
import { cpus } from "node:os";
const baseExclude = [
"**/node_modules/**",
"**/dist/**",
"**/.review/**",
"**/.worktrees/**",
"**/.kspec-worktrees/**",
"**/tests/e2e/**",
];
// These integration suites perform real git worktree/shadow-lock/bootstrap I/O.
// They pass in isolation but can time out when competing with the rest of the
// full suite, so run them in a dedicated serial project after the default pool.
const heavySerialSuites = [
"tests/dispatch-workspace-config.test.ts",
"tests/dispatch-workspace-registry.test.ts",
"tests/dispatch-workspace-cleanup.test.ts",
"tests/canonical-task-workspace-contract.test.ts",
"tests/dispatch-runtime-bootstrap-contract.test.ts",
// CLI-heavy integration suites that spawn 100+ subprocesses each.
// Under full-suite concurrency they exhaust process/fd limits and
// crash with STACK_TRACE_ERROR or assertion failures.
"tests/integration.test.ts",
"tests/agent-dispatch-engine.test.ts",
"tests/activity-display.test.ts",
"tests/cli/session-note-limit.test.ts",
"tests/cli/session-start-format.test.ts",
"tests/cli/session-start-notes.test.ts",
"tests/cli/session-start-activity-timeline.test.ts",
"tests/meta.test.ts",
];
// On machines with many cores vitest spawns one worker per core by default.
// Each worker can trigger dozens of kspec CLI subprocesses, leading to resource
// exhaustion (fd limits, process table pressure) on repeated full-suite runs.
// Cap at 8 workers to keep subprocess fan-out manageable.
const defaultMaxWorkers = Math.min(cpus().length, 8);
export default defineConfig({
test: {
projects: [
defineProject({
test: {
name: "default",
globals: true,
environment: "node",
testTimeout: 45_000,
maxWorkers: defaultMaxWorkers,
globalSetup: "./tests/global-setup.ts",
setupFiles: ["./tests/setup.ts"],
exclude: [...baseExclude, ...heavySerialSuites],
sequence: {
groupOrder: 0,
},
},
}),
defineProject({
test: {
name: "heavy-serial",
globals: true,
environment: "node",
testTimeout: 45_000,
globalSetup: "./tests/global-setup.ts",
setupFiles: ["./tests/setup.ts"],
include: heavySerialSuites,
exclude: baseExclude,
fileParallelism: false,
maxWorkers: 1,
sequence: {
groupOrder: 1,
},
},
}),
],
},
});