Repository navigation
✅ test(ui): polyfill in-memory localStorage for Node 26 vitest (UI-TEST-01) - #147
Merged
Merged
Conversation
Node 26 runs vitest without --localstorage-file, leaving window.localStorage undefined and breaking two inventory store tests. Add a minimal in-memory localStorage mock to the existing vitest setup file, guarded like the existing scrollTo polyfill.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
konih
added a commit
that referenced
this pull request
Jul 31, 2026
Bump chart version/appVersion 0.10.0 -> 0.11.0 for the next minor. Unreleased since v0.10.0: feat(netguard) NET-01 --allow-private-sinks opt-in (#146) + fix(controller) inventory store source Start non-blocking / DR-FIND-01 (#143), plus DR-FIND-03 lab-bootstrap docs (#148), UI-TEST-01 (#147), SEC-04j CI-hardening (#150).
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.



UI-TEST-01 (P3) — fix 2 pre-existing Node-26 localStorage test failures
Under Node 26, vitest runs without
--localstorage-filesowindow.localStorageis undefined, and 2 tests inui/src/store/inventory.test.ts("persists column visibility toggles", "resets to defaults") threwTypeError: Cannot read properties of undefined. A/B-verified as pre-existing on clean main, unrelated to any dep bump.Fix: minimal in-memory
Storagepolyfill in the existingui/src/test/setup.ts, guarded by!window.localStorage(mirrors the existingwindow.scrollTopolyfill in the same file), installed viaObject.defineProperty. Test-only; no production source, no vite bundle.Gates:
npm test50/50 green (Node v26.5.0);npm run lintclean;npm run typecheckclean. Independent review: APPROVE, no findings — the target tests are behavioural round-trips (store setItem→getItem), so the polyfill is genuinely exercised.