Repository navigation
Run the unit tests in CI, and fail the gate when none run - #15
Merged
Merged
Conversation
The unit tests are TypeScript that Node runs through its own type stripping (they import './oracle.ts'). CI pinned Node 20, which has no type stripping, so `node --test` discovered no test files at all and the deploy gate passed with "# tests 0" — run 35186536668 on e57bb57. - CI uses Node 24, where the same files load and 13 tests run. - `npm test` now runs scripts/test.mjs, which drives node:test's own runner over src/**/*.test.ts and exits non-zero if no file matches, if the matched files define no tests, or if any test fails. `node --test` alone exits 0 on an empty run, including for a glob that matches nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the findings in systemslibrarian/crypto-lab#2 ("the unit-test step runs 0 tests").
Why no tests ran
The unit tests are TypeScript that Node runs through its own type stripping (
import … from './oracle.ts'). The deploy workflow pinned Node 20, which has no type stripping, sonode --testnever looked at.tsfiles. It found nothing to run and exited 0. The latestmainbuild (run 35186536668, commite57bb57) logged:and the gate passed.
The fix
CI uses Node 24. The same test files load, and 13 tests run.
npm testnow runsscripts/test.mjs. This drives node:test's own runner oversrc/**/*.test.tsand exits non-zero if:node --testalone exits 0 on an empty run, even for a glob that matches nothing.Checked locally before pushing: the real suite passes with 13 tests. Each failure case exits 1: a pattern matching no files, a matched file with no tests, and a failing test. Loading the runner under Node 20 fails immediately rather than passing.
Test count from this PR's CI log
From this PR's run (35753742748, commit
bfa6c00), step Run tests:On
main, the same step (run 35186536668) reported# tests 0.Nothing else changed: no test, source or other workflow step.
Generated with Claude Code