Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

test: say which CI job and which files the discovery guard covers

Sameh Khamis85754bcf50c7
diff --git a/scripts/run-unit-tests.mjs b/scripts/run-unit-tests.mjs
index 7024ea38c..6cc6aaa94 100644
--- a/scripts/run-unit-tests.mjs
+++ b/scripts/run-unit-tests.mjs
@@ -25,10 +25,11 @@ export function assertNode24AllocationRuntime(version = process.versions.node) {
* Directories this runner searches for `*.test.mjs`, in stable order.
*
* `server/` belongs here because provider modules own tests of their own: a
- * suite placed beside the module it covers must run, and `npm test` is the only
- * thing CI invokes, so a directory missing from this list is a suite that never
- * runs anywhere. `unitTestRunner.test.mjs` asserts the list covers every test
- * file in the repository, so adding a tree without adding it here fails.
+ * suite placed beside the module it covers must run, and CI's unit-test job runs
+ * `npm test`, so a directory missing from this list is a suite that never runs
+ * there. `unitTestRunner.test.mjs` asserts the list covers every `*.test.mjs`
+ * outside dependencies, build output and dot-directories, so adding a tree
+ * without adding it here fails.
*/
export const UNIT_TEST_ROOTS = Object.freeze(['src', 'server']);
diff --git a/src/unitTestRunner.test.mjs b/src/unitTestRunner.test.mjs
index 201f6ed8e..80d9091e0 100644
--- a/src/unitTestRunner.test.mjs
+++ b/src/unitTestRunner.test.mjs
@@ -64,11 +64,12 @@ test('unit runner serializes only GC-bracketed allocation microbenchmarks', () =
});
test('the runner discovers every test file in the repository', () => {
- // `npm test` is the only suite CI runs, and it runs exactly what this
- // function returns. A `*.test.mjs` outside the searched roots therefore never
- // executes anywhere, while still reading — in review and to its author — like
- // covered code. Compare the two sets rather than their sizes, so the failure
- // names the files instead of only disagreeing about a count.
+ // CI's unit-test job runs `npm test`, which runs exactly what this function
+ // returns. A `*.test.mjs` outside the searched roots therefore never runs
+ // there, while still reading — in review and to its author — like covered
+ // code. Compare the two sets rather than their sizes, so the failure names the
+ // files instead of only disagreeing about a count. The final equality also
+ // catches the reverse: files the runner finds that this walk skips.
const discovered = discoverUnitTestFiles(repositoryRoot);
const onDisk = testFilesOnDisk(repositoryRoot);
const undiscovered = onDisk.filter((file) => !discovered.includes(file));