test: give the suite a real localStorage on Node 25 - #311
Open
ivanmkc wants to merge 1 commit into
Open
Conversation
Node 25 defines a global localStorage whose methods do nothing unless the process was started with --localstorage-file. It is installed before the test environment gets there, and happy-dom's window IS globalThis under vitest, so window.localStorage is the same stub -- there is no browser storage anywhere to fall back to. Two tests have been failing locally on Node 25 while CI, pinned to Node 20 and 22, stayed green. That is the worst shape a failure can have: it bites only the person running the tests, and only on a runtime newer than the one CI proves. A setup file installs a Map-backed Storage instead. Spec-shaped in the ways the code under test relies on: string values, null for a missing key, and length/key() enumerating in insertion order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 2, 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.
The stack
localStoragefor the test suite on Node 25@ivanmkc/termchart-canvas; injectable interact transportEvery branch in the stack was checked out on its own and verified independently:
npm install,tsc --noEmitfor every package,npm testacross the workspace, and the offline e2e where it exists. All twenty are green — no branch depends on a later one to build or pass. Full viewer e2e (11 suites, 106 assertions) was run on #312 as the behaviour-preservation evidence for the extraction.Stack position: 1 of 10. Base:
design/lifeboard.Node 25 defines a global
localStoragewhose methods do nothing unless the process was started with--localstorage-file. It is installed before the test environment gets there, and happy-dom'swindowisglobalThisunder vitest — sowindow.localStorageis the same stub, and there is no browser storage anywhere to fall back to.Two tests have been failing locally on Node 25 while CI, pinned to Node 20 and 22, stays green. That is the worst shape a failure can have: it bites only the person running the tests, and only on a runtime newer than the one CI proves.
A setup file installs a Map-backed
Storageinstead — spec-shaped in the ways the code under test relies on: string values,nullfor a missing key, andlength/key()enumerating in insertion order.Verified: viewer 747 tests pass on Node 25 (was 746 passing, 1 failing).
🤖 Generated with Claude Code