Test selection finds tests for NodeNext .js imports and Rails specs (#4679)

In TypeScript repos that import `./x.js` for `x.ts` (NodeNext) and in
Rails repos, touched source files now get their tests instead of none.

Why: `/verify` and `/ship` found no tests for these files even though
tests covered the files (#4398, #4211).

Nothing to do: a Rails file maps only when its spec exists at the
conventional path.

Co-authored-by: mikhailsal <14850941+mikhailsal@users.noreply.github.com>
Co-authored-by: Ikraam Ghoor <34813339+ikraamg@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1v/adversarial-native#1 reader=adversarial-native
Review-Finding: p1v/adversarial-native#2 reader=adversarial-native
Review-Finding: p1v/adversarial-native#3 reader=adversarial-native
Review-Finding: p1v/outside-voice#2 reader=outside-voice
Review-Finding: p1v/outside-voice#3 reader=outside-voice
This commit is contained in:
authored and GitHub committed 2026-11-22 12:32:40 +00:00
1 parent 7530280407
commit 4bd15f8a3d
5 files changed
+113 -4

No files matched your search

+7 -1
View File
@@ -324,7 +324,9 @@ Two stages with separate clocks, both printed:
- `lanes`: touched files map to tests through `lib/pregate/import-graph.ts`
(static imports ∪ repo-path string literals ∪ the `bin/<name>` →
`test/<name>*.test.ts` convention ∪ `dependencies`; Dart `import`/`export`/`part`
`test/<name>*.test.ts` convention ∪ RSpec's `[<root>/]spec/<path>_spec.rb` →
`[<root>/]app/<path>.rb` or `[<root>/]<path>.rb` convention, for whichever exists
(request and system specs name no single source file and map to none) ∪ `dependencies`; Dart `import`/`export`/`part`
directives resolve `package:<name>/x` through every tracked `pubspec.yaml`, and
`*_test.dart` files under a `test/` directory are tests, except under `integration_test/` and
`test_driver/`: they need a device, so pregate never runs them, and a touched
@@ -377,6 +379,10 @@ Two stages with separate clocks, both printed:
`baseUrl`) tries the exact path, then `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`,
`.cjs`, `.mts`, `.cts`, then `index.ts`, `index.tsx`, `index.js`, `index.jsx`
and `index.mjs` inside the directory; the first file that exists wins.
An import written with the emitted extension (NodeNext: `./x.js` for `x.ts`
or `x.tsx`, `.jsx` → `.tsx`, `.mjs` → `.mts`, `.cjs` → `.cts`) resolves to
its TypeScript source first, as tsc does, even when a compiled `.js` sits
beside it, then as written; a path string literal always names the file as written.
A touched source file with no lane is `FAIL lanes — <file> has no test lane`
once a policy that [declares lanes](#lane-requirements) exists (the base copy,
the user-owned file or `--policy-from head`); with no policy anywhere, or one