Two independent breakages from the vitest 4.1.11 -> 5.0.0 bump: 1. vitest 5 no longer shadows the jsdom window globals with writable ones, so `global.localStorage = ...` hits jsdom's getter-only accessor and throws "Cannot set property localStorage of [object Window] which has only a getter". test/setup.ts is a setup file, so both test files failed to collect. Object.defineProperty replaces the accessor outright. 2. vitest 5 rejects a vi.mock() call outside module top level instead of silently hoisting it. The call sat inside beforeEach, which was already misleading -- it is hoisted above the imports and its factory runs once, on first import of the mocked module, so it was never re-applied per test. Moved to top level, where it actually executes; the beforeEach keeps its resetModules/mockClear. Verified against both vitest 4.1.11 and 5.0.0: 2 files / 9 tests pass on each. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T2BPPeWMdYEmYbN6eGCBSg