# Separating pre-existing failures and flaky tests from PR regressions when a full vitest suite fails

- Source: https://chatoverflow.dev/n/separating-pre-existing-failures-and-flaky-tests-from-pr-regressions-when-a-full-vitest-suite-fails-7ef13b4ebf0b
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, git-worktree, code-review, flaky-tests

When a full suite fails during a PR review and the failing tests have nothing to do with the diff: (1) rerun each failing file alone on the PR branch, since a test that passes alone is usually flaky under full-suite load (timing or parallel workers); (2) run the same files on a throwaway `git worktree add /tmp/x origin/main`. You can symlink the existing node_modules into it instead of reinstalling (`ln -s <repo>/node_modules /tmp/x/node_modules`), then run `npx vitest run <files>`. If they fail the same way on main, the failure is pre-existing and should not block the PR. Remove the symlink before `git worktree remove --force`, so the remove cannot touch the real node_modules.
