fix: make npm run test runnable and enforce it in CI - #85
Merged
Conversation
The test suite could not be run end to end. Two independent blockers, neither of which was a bug in the tests themselves. Wrong Node version. `CLAUDE.md` documented `Node.js >=18.17.0, <21`, but the root `package.json` requires `>=22` and CI uses 22. On Node 20 a CommonJS spec that requires an ESM module - any browser spec that reaches `@theia/monaco-editor-core` - takes the synchronous `require(esm)` loader, which ignores the hooks `@theia/test-setup` registers via `register()`. The run dies on `ERR_UNKNOWN_FILE_EXTENSION ... aria.css`, and because mocha retries a failed `import` with `require`, the spec is partially executed twice and the retry reports the far more confusing `The configuration is already set.` instead. Same tree on Node 23: the whole `ai-core` suite passes. So: correct the documented requirement, add `.nvmrc`, and fail fast in `@theia/test-setup` with the actual reason when running on Node < 22. Spec-less packages. `@theia/cooklang-account` and `@theia/cooklang-branding` declared `"test": "theiaext test"` without having a single spec file. Mocha exits non-zero on `No test files found`, and `test:theia` runs with `--concurrency=1` under nx bail, so the run aborted there and skipped every package after it. Upstream only declares the script where specs exist; do the same, and note it in the "adding a new package" checklist. `npm run test:theia` now passes: 40 projects, 1936 tests, 0 failing. Wire it into `pr.yml`, which until now ran only compile and lint - which is why this went unnoticed. `test:electron` is deliberately left out; it needs a display server and the packaged app. Fixes #84
This was referenced Aug 11, 2026
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.
Fixes #84. See this comment for the full trace — my original diagnosis in the issue body was wrong, and the corrected one is what this PR acts on.
Two independent blockers, neither a bug in the tests themselves.
1. Wrong Node version
CLAUDE.mddocumentedNode.js ≥18.17.0, <21. The rootpackage.jsonrequires>=22, and CI uses 22 — so the contributor-facing docs pointed at exactly the versions where the suite cannot load.On Node 20 a CommonJS spec that requires an ESM module (any browser spec reaching
@theia/monaco-editor-core) takes the synchronousrequire(esm)loader, which ignores the hooks@theia/test-setupregisters viaregister():Worse, mocha retries a failed
importwithrequire, so the spec is partially executed twice and the retry surfacesThe configuration is already set.— burying the real error entirely.Fix: correct the documented requirement, add
.nvmrc(22), and fail fast in@theia/test-setupwith the actual reason:2. Spec-less packages abort the run
@theia/cooklang-accountand@theia/cooklang-brandingdeclared"test": "theiaext test"but contain no spec files. Mocha exits non-zero onNo test files found, andtest:theiaruns--concurrency=1under nx bail — so the run stopped there and skipped ~40 packages. Upstream only declares the script where specs exist; these two now match, and the "adding a new package" checklist inCLAUDE.mdcalls it out.Result
1936 tests passing, 0 failing.
Added as a
Teststep inpr.yml, which until now ran only compile and lint — which is why this went unnoticed.test:electronis deliberately excluded: it needs a display server and the packaged app, so wiring it up means xvfb and a different kind of flake budget.Note for reviewers
This PR does not change any test or product code — only docs,
.nvmrc, twopackage.jsonscripts, a Node version guard, and the CI step. TheTeststep is new and unproven on CI hardware; if it turns out slow or flaky there, the cheap fallback is to keep it but mark it non-blocking.