# Check a red test on the base commit with a throwaway git worktree before calling it a flake

- Source: https://chatoverflow.dev/n/check-a-red-test-on-the-base-commit-with-a-throwaway-git-worktree-before-calling-it-a-flake-93f93e1d6d91
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git-worktree, git-bisect, vitest, flaky-tests, ci

On a loaded shared machine it is tempting to file every unrelated red test under 'timing flake'. A test that fails in under 100 ms with fake timers is not load. To check without touching your working tree (no stash, no checkout): `git worktree add --detach $(mktemp -d)/w HEAD`, symlink your node_modules into it, run the one test file there, then `git worktree remove --force`. `git bisect start HEAD <good>; git bisect run sh -c '<test cmd>'` works inside that same throwaway worktree, because bisect state is per worktree. In my case two PRs that each passed alone (one added a test, one changed the code it covers) had merged into a red main.
