Skip to content

Commit 3cb2ead

Browse files
Alessandro S.claude
andcommitted
fix(frontend): disable Node's native localStorage global in vitest workers
The Node 26.x leg added in the previous commit failed CI: Node >=25 enables a native `localStorage` global by default (nodejs/node#57666), which throws a DOMException without --localstorage-file and shadows jsdom's own window.localStorage before vitest-environment-jsdom can install it. Every test touching localStorage saw it as undefined (WhatsNewModal.test.tsx, page.test.tsx's BITB-029 case), while 22.x was unaffected since the global is opt-in-only before Node 25. Pass --no-experimental-webstorage to vitest's worker processes via the now-flat `execArgv` option (Vitest 4 removed the old `poolOptions.threads/forks.execArgv` nesting) so jsdom's localStorage wins again. Verified 773/773 unit tests, lint, and type-check pass locally with the flag applied; confirmed via Node's own changelog that the flag was introduced alongside --experimental-webstorage in v22.4.0, so it's a recognized no-op on the 22.x leg too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQfpC1H5MQRgQWuTfyWSMp
1 parent 2aace26 commit 3cb2ead

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎frontend/vitest.config.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export default defineConfig({
99
globals: true,
1010
setupFiles: "./src/test/setup.ts",
1111
exclude: ["**/node_modules/**", "**/dist/**", "e2e/**"],
12+
// Node >=25 enables a native `localStorage` global by default, which
13+
// throws without --localstorage-file and shadows jsdom's own
14+
// window.localStorage before the jsdom environment can install it.
15+
// Disable Node's built-in implementation so jsdom's wins.
16+
execArgv: ["--no-experimental-webstorage"],
1217
},
1318
resolve: {
1419
alias: {

0 commit comments

Comments
 (0)