Repository navigation
Description
Summary
Every src/**/*.{ts,tsx} edit pays the whole unit lane: .claude/hooks/unit-test.mjs runs
pnpm test:run as a PostToolUse hook. Measured 2026-10-11 on 4 cores that is ~28s over 1698
tests in 133 files. docs/testing.md asked for "under ~5s" and nothing has been under it since the
jsdom specs arrived, so the lane currently has no stated bound and nothing owns its growth.
Approach
- The cost is measured and lopsided. 113 node-only files take ~16s; the 25 jsdom files add
~12s on top (docs/testing.md, "The jsdom exception"). List them with
grep -rl '@vitest-environment jsdom' src/. The jsdom opt-in is where a reduction is available. - Options to weigh, none chosen here:
- A second vitest project (
vitest.config.ts) splitting node from jsdom, with the hook running
only the lane that can cover the edited file. - Related-file selection in
.claude/hooks/unit-test.mjs—vitest related <file>— so an edit
pays its own specs rather than the suite. ⚠ Nine specs walk all ofsrc/and so are related
to every file (see the sibling ticket on the shared source walker), which caps what this buys. - Converting jsdom specs back to SSR where
docs/testing.md's precedent list does not justify a
DOM. Each conversion must keep the assertion non-vacuous — that file's own closed-portal
section is the trap.
- A second vitest project (
- Then state one number in
docs/testing.mdand have the hook note cite it, instead of the
figure-restating this ticket replaced.docs/testing.md's hook note links here today.
⚠ The hook reports failures as non-blocking context, so a slower lane fails nothing and shows up
only as latency on every edit. That is why it needs a stated budget rather than a feeling.
Acceptance criteria
-
docs/testing.mdstates one lane budget, and the per-edit hook note cites that budget. - The command the hook runs completes inside the stated budget on a 4-core machine.
- Any spec moved off jsdom still fails when its defect is reintroduced at the causing site.
Verification checklist
-
time pnpm test:run, three runs on 4 cores; report the median against the stated budget -
grep -rl '@vitest-environment jsdom' src/ | wc -lbefore and after -
pnpm lint && pnpm typecheck && pnpm test:rungreen
Notes
Found addressing the review on #284, whose docs/testing.md thread asked for a bound or a ticket
owning the cost. #284 cites this ticket rather than restating a figure nothing checks.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
docs(testing): give the lane budget an owner instead of a figure
Ardnived commentedon Oct 13, 2026
@sydevs-bot implement
sydevs-bot commentedon Oct 13, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
docs(test): correct the lane counts and record what the hook now covers