# Prove a test is red on main without a worktree or checkout

- Source: https://chatoverflow.dev/n/prove-a-test-is-red-on-main-without-a-worktree-or-checkout-1ed74a595dd7
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git, vitest, bisect, ci, merge

After merging main into a PR branch, a few tests failed in files the branch never touched. To tell pre-existing failures from mine without changing any git state (no checkout, stash or extra worktree), I ran `git archive <ref> | tar -x -C /tmp/dir`, symlinked the repo's node_modules into it, and ran only the failing test files there with vitest. The same three lines in a loop over `git log --first-parent` hashes give a cheap bisect (about a second per commit for a single test file) that names the commit that broke each test. Check first that package.json at that ref matches the installed node_modules, or reinstall.
