Skip to content

chore(web): declare the Node floor the test environment actually needs - #321

Merged
saucam merged 2 commits into
mainfrom
chore/web-node-engine
Sep 5, 2026
Merged

chore(web): declare the Node floor the test environment actually needs#321
saucam merged 2 commits into
mainfrom
chore/web-node-engine

Conversation

@saucam

@saucam saucam commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

The symptom

bun run test in web/ on Node 20.18 dies with an error that names neither Node nor jsdom:

Error: require() of ES Module .../@exodus/bytes/encoding-lite.js
from .../html-encoding-sniffer/lib/html-encoding-sniffer.js not supported.

The cause

jsdom@29 pulls html-encoding-sniffer@6, which is CommonJS and does require("@exodus/bytes/encoding-lite.js"). @exodus/bytes@1.15.1 is "type": "module" — ESM-only.

That combination only works where require(esm) is unflagged: Node 20.19.0+ or 22.12.0+ (backported to 20.19). CI runs a new enough runtime, so it has never surfaced there. A local Node one patch below the line loses the entire jsdom test environment.

Why a field rather than a README line

The failure mode is quiet in the place people look. Vitest reports the six jsdom suites as an "unhandled error" while still printing:

 Test Files  12 passed (12)
      Tests  161 passed (161)
     Errors  1 error

So the run looks green while every component test silently did not run — App.esc, BlackboardDrawer, NewSessionModal, PackBrowser, SessionControls, and SessionListPane.

The exit code is 1, so CI stays honest. It's the human reading the summary who gets misled — which is exactly how I nearly shipped #320 believing its component test had run.

What this does not do

No dependency or lockfile change. Nothing is broken in CI, and pinning around a working setup to accommodate an old local runtime would be the wrong trade. This only makes the existing requirement explicit, so npm install warns with the real reason instead of surfacing an ESM/CJS stack trace later.

>=20.19 rather than >=22 deliberately: 20.19 is the actual boundary, and there's no reason to exclude a working LTS.

🤖 Generated with Claude Code

saucam and others added 2 commits September 5, 2026 21:20
Running `bun run test` on Node 20.18 fails to load the jsdom
environment, and the error names neither Node nor jsdom:

  Error: require() of ES Module .../@exodus/bytes/encoding-lite.js from
  .../html-encoding-sniffer/lib/html-encoding-sniffer.js not supported.

jsdom 29 pulls html-encoding-sniffer 6, which is CommonJS and requires
@exodus/bytes — an ESM-only package. That only works where require(esm)
is unflagged: Node 20.19.0+ or 22.12.0+. CI is on a new enough runtime,
so this never showed up there; a local Node one patch below the line
loses the whole jsdom test environment.

The failure mode is what makes this worth a field rather than a README
line: vitest reports the six jsdom-based suites as an "unhandled error"
while still printing `Test Files 12 passed`, so the run LOOKS green even
though every component test — App.esc, BlackboardDrawer, NewSessionModal,
PackBrowser, SessionControls, SessionListPane — silently did not run.
The exit code is 1, so CI is honest; a human reading the summary is the
one who gets misled.

Declaring the floor turns that into an install-time warning naming the
real requirement. No dependency or lockfile change: nothing is broken in
CI, and pinning around a working setup to suit an old local runtime
would be the wrong trade.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@saucam
saucam merged commit c52da17 into main Sep 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants