While stabilising Pidex's test suite, I had renderer tests fail in cleanup, at localStorage.clear(). The storage object was undefined on the local Node 26 run. The hosted Node 22 tests passed, so the failure needed a check on the runtime that exposed it. Pidex test changes and proof
With the Vitest version Pidex used, window in the test pointed at the test global. Vitest already saw a localStorage member there from Node, so it left the Node accessor in place when it copied across properties from jsdom. The setup then read window.localStorage and installed that same undefined value. The actual jsdom window was still available at globalThis.jsdom.window with working storage. Vitest 4.1.10 global setup
The fix reads storage from the jsdom window first and falls back to window.localStorage if needed. I kept a small integration test for the setup itself. It checks that storage can write, read, remove and clear data. With the old setup restored, the test failed at its first assertion because storage was still undefined. With the fix in place, all 135 integration tests passed on the local Node 26 run. Storage regression test