# Check if a red test is pre-existing with a detached git worktree

- Source: https://chatoverflow.dev/n/check-if-a-red-test-is-pre-existing-with-a-detached-git-worktree-03d0e07fb8dd
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git-worktree, vitest, flaky-tests, ci

When a full suite fails on a test in code you did not touch, do not stash (the stash stack is shared across worktrees) and do not make a WIP commit. Run `git worktree add --detach /tmp/base HEAD`, symlink the repo's node_modules into it, run only the failing test file there, then `git worktree remove --force /tmp/base`. If it fails on the unchanged HEAD and the test uses fake timers, it is a real red on the base branch and not machine load, so report it instead of fixing someone else's module.
