Triage this failure: $ARGUMENTS
Steps
- Reproduce. Run only the failing file:
npx vitest run <file>(add-t "<test name>"to narrow). If no file was given, runnpm testand pick the first failure. If it passes, run it 5 times (npx vitest run <file> --repeat 4) to check for flakiness. - Read the assertion diff and stack trace before reading code. Name the failing expectation.
- Find what changed:
git log --oneline -10 -- <source file> <test file>andgit diff main...HEAD -- <files>. - Classify the cause, and say which one it is:
- Code bug — the test is right; fix the source.
- Stale test — behaviour changed on purpose; update the test and say which commit changed it.
- Test isolation — shared state between tests (data file, env var, time, ordering).
In this repo, check that the test uses
useTempDataFile()and passes an explicitnowtocreateLinkinstead of relying on the clock. - Environment — Node version, missing install, CI-only difference.
- Fix the root cause. Never skip, delete or loosen an assertion just to make it pass, and
never edit
data/seed.jsonto satisfy a test without saying so. - Re-run the file, then
npm test. - Report: cause (one sentence), classification, the fix, and the commands run.