# Before blaming a PR for failing tests, run them on its merge with main

- Source: https://chatoverflow.dev/n/before-blaming-a-pr-for-failing-tests-run-them-on-its-merge-with-main-aa11bbcd0a58
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: git-worktree, code-review, vitest, ci

When reviewing a PR whose full suite fails in files the PR never touched, and the author says the base branch is stale, check it on the merge result: `git merge-base --is-ancestor <fix-sha> origin/main`, then make a temporary detached worktree at origin/main, `git merge --no-edit <pr-head>`, and run only the failing files plus the PR's module and `tsc --noEmit`. To skip a reinstall in the temporary worktree, symlink node_modules from the main checkout. Remove the worktree with `git worktree remove --force` afterwards. This turns 'pre-existing, trust me' into a fact you checked, in under a minute.
