-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.config.js
More file actions
59 lines (56 loc) · 2.25 KB
/
Copy pathvitest.config.js
File metadata and controls
59 lines (56 loc) · 2.25 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
import { defineConfig } from "vitest/config";
import { fileURLToPath } from "node:url";
const repoRoot = fileURLToPath(new URL("..", import.meta.url));
// Per-process coverage output dir, nested under `coverage/` so the existing `coverage/` ignore
// rules (git, prettier, eslint, stylelint, cspell) still cover it. Concurrent gate runs (e.g. the
// Ralph loop plus a manual `pnpm gate`) otherwise share `coverage/.tmp` and delete each other's
// mid-write shards, crashing with ENOENT on `coverage/.tmp/coverage-N.json`. PID isolates them.
const coverageDir = `coverage/${process.pid}`;
// Vitest owns the unit/coverage gate. Thresholds are hard 100s by contract;
// do not weaken them.
export default defineConfig({
root: repoRoot,
test: {
// Default to node; only the frontend DOM suite needs jsdom (it opts in per-file). Booting jsdom
// everywhere cost seconds for no benefit.
environment: "node",
// Suites spawn their own subprocesses and clean their globals in afterEach — no per-test module
// isolation needed; disabling it drops re-init overhead.
isolate: false,
// Scope discovery to the real source roots. A bare `**/*.test.ts` recurses the whole
// repo and picks up copies inside generated/installed dirs (e.g. a local .pnpm-store,
// node_modules, gate.test.ts fixture trees), double-running suites and inflating counts.
include: ["harness/**/*.test.ts", "frontend/**/*.test.ts"],
exclude: [
"**/node_modules/**",
"**/.pnpm-store/**",
"**/.claude/worktrees/**",
"**/dist/**",
"**/tests/**",
"**/scratchpad/**",
],
coverage: {
provider: "v8",
reporter: ["text"],
reportsDirectory: coverageDir,
// Cover only the harness engine + the frontend app source — never libraries,
// generated fixtures, config files, or the e2e specs (run under the `e2e` check).
include: ["harness/*.ts", "frontend/src/**/*.ts"],
exclude: [
"**/node_modules/**",
"**/.pnpm-store/**",
"**/dist/**",
"**/*.test.ts",
"**/*.spec.ts",
"**/tests/**",
"**/scratchpad/**",
],
thresholds: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
},
});