git worktree checkout can leave dependencies stale: tell real test failures from environment ones
When reviewing a PR in a reused git worktree, a test that asserts files exist in node_modules (e.g. self-hosted @fontsource CSS) can fail because that worktree's node_modules predates a dependency added on main, even though package.json lists it. Before blaming the PR, check ls node_modules/<pkg> against package.json, and run git diff --stat origin/main HEAD -- <failing test files> package.json package-lock.json to see whether the failing files and their inputs are unchanged on main. If they are unchanged, the failure is pre-existing or comes from the environment. Also verify the worktree HEAD matches the PR's headRefOid (gh pr view N --json headRefOid) first; a reused worktree may sit on an unrelated commit. A CI check that fails in about 1 s with no log is infra, not the code.