Skip to content

refactor(test): extract the duplicated Node 26 jsdom localStorage guard into a shared helper #7620

Description

@JSONbored

Context

#7612's fix mirrored #7597's Node 26 jsdom/localStorage guard verbatim into apps/loopover-ui and
packages/loopover-ui-kit, on top of the existing copy already in apps/loopover-miner-ui. The gate's
own review of #7612 flagged this as a nit: three copies of the same ~15-line guard that can drift, and
a fourth future jsdom-environment workspace wouldn't automatically inherit the fix -- someone would have
to remember to copy it again from scratch, the same way this bug was independently rediscovered twice.

Requirements

  • Extract the guard into a single shared module, exporting one function
    (patchJsdomLocalStorageForNode26).
  • Update all three existing vitest.setup.ts files (apps/loopover-ui, apps/loopover-miner-ui,
    packages/loopover-ui-kit) to import and call it instead of inlining the logic.
  • No behavior change: same guard, same no-op-on-Node-22/24 / fix-on-Node-26+ semantics.

Deliverables

  • Shared helper module with the extracted guard + its full rationale comment.
  • All three vitest.setup.ts files updated to a single import + one-line call.
  • Full test suites for all three consuming workspaces pass on Node 26 (regression proof: any of the
    ~30 tests across the three workspaces that touch localStorage would fail if the extraction broke
    the guard).

Test Coverage Requirements

The helper lives under test/**, outside Codecov's src/**-only include glob, so it owes no
patch-coverage number. No dedicated unit test file for the helper itself, matching this repo's existing
test/helpers/*.ts convention (e.g. test/helpers/d1.ts has no standalone test file either) -- it's
exercised indirectly, and thoroughly, by the real consuming test suites in all three workspaces.

Expected Outcome

A future jsdom-environment workspace closes this exact gap by importing the shared helper, not by
rediscovering and re-copying the guard from scratch.

Links & Resources

Metadata

Metadata

Assignees

Labels

gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions