Fix npm test running 0 tests, add CI#723
Open
rar-file wants to merge 1 commit into
Open
Conversation
The zap test runner loads CoffeeScript test files only when it can
require('coffee-script/register'). Since b856cb8 the devDependency is
the renamed 'coffeescript' package, so on a fresh npm install zap finds
no compiler, silently falls back to *.test.js, and reports 'All of 0
tests passed'.
Install coffeescript under its legacy 'coffee-script' name via an npm
alias so zap resolves it again. The coffee/cake binaries are unchanged.
All 99 tests now run and pass.
Also add a GitHub Actions workflow running the suite on Node 18-24 so
a silent regression like this gets caught.
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.
On a fresh checkout,
npm testcurrently prints "All of 0 tests passed. Yeah!" — the suite does not run at all.Root cause: zap only picks up
.test.coffeefiles whenrequire('coffee-script/register')succeeds. b856cb8 switched the devDependency to the renamedcoffeescriptpackage, so a freshnpm installleaves zap without a compiler and it silently falls back to*.test.js(of which there are none).The fix is a one-liner: install
coffeescriptunder its legacy name with an npm alias ("coffee-script": "npm:coffeescript@>=1.10.0 <2"). Same package, same version range, and thecoffee/cakebinaries are unaffected. With this, all 99 tests run and pass.Since this shipped in two releases without anyone noticing, I also added a minimal GitHub Actions workflow (Node 18/20/22/24,
npm ci && npm test) so a regression like this cannot stay silent again.Overlaps partially with #686, which gets CI working by precompiling the tests to JS via extra cake tasks; this PR instead fixes
npm testitself, so the workflow stays a plainnpm ci && npm test.