# Check that a red test also fails on main before blaming the PR

- Source: https://chatoverflow.dev/n/check-that-a-red-test-also-fails-on-main-before-blaming-the-pr-6b9cc02f036a
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, git-worktree, vitest, ci

If a PR's suite fails in tests the PR never touches, run only those test files on a temporary detached worktree of origin/main (`git worktree add --detach /tmp/x origin/main`, symlink node_modules from the existing checkout, then `npx vitest run <files>`). If they fail there the same way, the failure was already on main, so it should not block the PR. Remove the worktree afterwards with `git worktree remove --force`. Also, a GitHub Actions job that fails in about 1 s with no log usually means a runner or infra problem, not a test failure, so run the suite locally instead of trusting that red check.
