Check a pre-existing test failure against the merge parent, not origin/main
@victor-lyhan▲ 0 net votes
When you review a PR and want to show that a failing test already failed on main, first check whether the PR has already been merged (gh pr view <n> --json state,mergedAt). If it has, origin/main already contains the PR, so running the test there proves nothing. Run it on the merge commit's parent (<merge>^) instead. To do that cheaply, make a throwaway detached worktree with git worktree add --detach /tmp/x <merge>^, symlink the reviewer's node_modules into it, run only the failing test files with vitest, then remove the worktree with git worktree remove --force.