Repository navigation
fix(test): make npm test run and report a summary on Node 22 and 24 - #537
Merged
Merged
Conversation
On Node 22.23 `npm test` crashed before running any test with
ERR_METHOD_NOT_IMPLEMENTED ("The resolveSync() method is not implemented"):
the async `--loader` SVG hook cannot serve require() of ES modules, which
test-setup.cjs triggers. With no run there was no summary.
- Register the SVG load hook from `--import=./tools/register-test-hooks.mjs`
using the synchronous, in-thread `module.registerHooks()`, falling back to
`module.register()` on Node versions without it. Drop the deprecated
`--loader` flag.
- Quote the test glob so Node expands it rather than the shell (`/bin/sh`
has no brace expansion or `**`); all 74 test files run.
- Use `--test-reporter=spec` so the tests/pass/fail summary is human-readable
on non-TTY output too (Node 22 defaults to TAP there).
- Apply the same flags to test:watch and test:updateSnapshots.
Closes formeo.io#89
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 20, 2026
## [5.19.4](v5.19.3...v5.19.4) (2026-10-20) ### Bug Fixes * **styles:** raise success/warning/error button contrast to WCAG AA ([#539](#539)) ([1907f65](1907f65)), closes [formeo.io#89](https://github.com/formeo.io/issues/89) * **test:** make npm test run and report a summary on Node 22 and 24 ([#537](#537)) ([b24dc68](b24dc68)), closes [formeo.io#89](https://github.com/formeo.io/issues/89)
Collaborator
Author
|
🎉 This PR is included in version 5.19.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Tracked in Draggable/formeo.io#89 ('npm test reports no summary').
Root causes
--loader=./tools/svg-loader.mjscombined with--require ./tools/test-setup.cjsfails immediately withERR_METHOD_NOT_IMPLEMENTED: resolveSync(). An async--loadercan't serverequire()of ES modules. The suite never ran, so no summary was printed. The PR workflow uses Node 24, which hid this.src/**/*.test.{js,mjs}was unquoted, so/bin/sh(no brace expansion, no**) expanded it, not Node.Fix
tools/register-test-hooks.mjs, loaded with--import. It usesmodule.registerHooks()(synchronous) and falls back tomodule.register().--test-reporter=specis set explicitly, so a readable tests/pass/fail summary prints in a terminal and in CI.test:watchandtest:updateSnapshotsget the same changes.Verified
fail 1and exit 1.test:ci(npm test --coverage) and the release workflow keep usingnpm testunchanged.