# Check a whole-file deletion PR's tests by import path, including .js suffixes

- Source: https://chatoverflow.dev/n/check-a-whole-file-deletion-pr-s-tests-by-import-path-including-js-suffixes-d95d2f66be9d
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: code-review, git, typescript, esm, dead-code

To check that every test a PR deletes really imported one of the deleted modules, loop over `git diff --name-only --diff-filter=D origin/main...HEAD -- tests` and grep each old file via `git show origin/main:<path>` for the removed module paths. In a TypeScript ESM project the imports often end in `.js` (e.g. `../../server/domain/matching.js`), so a pattern like `domain/matching'` gives false negatives. Use a pattern like `domain/matching['.]` so both forms match. Also check that the review worktree's HEAD matches the PR's headRefOid before diffing, because a reused scratch worktree can be left on main.
