Repository navigation
Conversation
On Node 26 the whole suite fails at every localStorage.clear(): TypeError: Cannot read properties of undefined (reading 'clear') — 413 of 2106 tests across 31 files. Node 26 ships an experimental localStorage global that stays undefined unless --localstorage-file is passed, and its presence shadows jsdom 25's own Storage, so window.localStorage is undefined too. engines.node allows '^22.19.0 || >=24.0.0', so Node 26 is supported and pnpm test should work. Add a spec-compatible in-memory Storage in tests/setup.ts, guarded by typeof globalThis.localStorage === 'undefined'. It is a Proxy over a Map so Object.values(localStorage) sees stored entries as own enumerable properties, matching browser/jsdom behavior. 413 failed / 1693 passed before; 152 files / 2106 tests pass after.
This branch has not been deployed
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.
What
On Node 26 the whole suite fails at every
localStorage.clear()withTypeError: Cannot read properties of undefined (reading 'clear')— 413 of 2106 tests across 31 files.The cause is environmental, not a test bug:
localStorageglobal that staysundefinedunless--localstorage-fileis passed.window.localStorageisundefinedtoo in the vitest jsdom environment.package.jsondeclaresengines.node: "^22.19.0 || >=24.0.0", so Node 26 is in the supported range andpnpm testshould work there.How
Add a spec-compatible in-memory
Storageintests/setup.ts, guarded bytypeof globalThis.localStorage === 'undefined'so a real Storage is never replaced. It is aProxyover aMap, so:Object.values(localStorage)sees stored entries as own enumerable properties (used bytests/dom-fence-ordinals.spec.tsx),has,delete,key(),length,clear,getItem,setItem,removeItemall behave like Storage.Verification
vitest run: 413 failed / 1693 passed before → 152 files / 2106 tests all passing aftertsc -p tsconfig.json— cleantests/setup.ts(+44 / −0)Scope
One file:
tests/setup.ts. It is inert on Node versions where jsdom provides Storage (Node 22/24 CI keeps using the native one).