Skip to content

chore(deps): upgrade vitest and coverage provider to 4#1689

Merged
xobotyi merged 2 commits into
masterfrom
deps/vitest-4
Jul 22, 2026
Merged

chore(deps): upgrade vitest and coverage provider to 4#1689
xobotyi merged 2 commits into
masterfrom
deps/vitest-4

Conversation

@xobotyi

@xobotyi xobotyi commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Upgrades vitest and @vitest/coverage-v8 3.2.4 → 4.1.10.

Compat fixes:

  • vitest 4 mocks with arrow-function implementations are no longer constructable. The observer tests mocked the ResizeObserver/IntersectionObserver constructors via vi.fn((cb) => ({...})) and failed with is not a constructor (16 tests across 3 files). Implementations extracted to function declarations.
  • Node ≥ 25 defines global localStorage/sessionStorage — non-functional stubs without --localstorage-file — and under vitest 4 they shadow jsdom's storage in test workers, failing 3 useStorageValue storage-event tests. Test workers now run with --no-experimental-webstorage (vitest 4 moved execArgv to a top-level test option) and the tests reference window.localStorage explicitly. This also unblocks re-adding Node latest to the CI matrix.

vitest.config.ts otherwise unchanged; coverage works (98.23% statements).

Rebased onto master independently of the eslint 10 PR (#1688 parked pending the oxc migration decision).

Verification: lint 0 problems (eslint 9), build clean, 527/527 tests pass, coverage runs.

xobotyi added 2 commits July 22, 2026 13:49
vitest 4 mocks with arrow-function implementations are no longer
constructable; observer tests mocked ResizeObserver and
IntersectionObserver constructors via 'vi.fn((cb) => ({...}))' and
failed with 'is not a constructor'. Implementations extracted to
function declarations, which stay constructable and do not trip
prefer-arrow-callback.

Config needed no changes; coverage output format is unchanged.
Node >= 25 defines global localStorage/sessionStorage; without
--localstorage-file they are non-functional stubs, and under vitest 4
they shadow jsdom's storage in test workers -- the storage-event tests
failed with 'Cannot read properties of undefined (reading getItem)'.

- vitest workers now run with --no-experimental-webstorage (vitest 4
  moved execArgv from poolOptions to a top-level test option)
- storage-event tests reference storage explicitly via
  window.localStorage / window.sessionStorage

Also unblocks re-adding Node 'latest' to the CI test matrix.
@xobotyi
xobotyi changed the base branch from deps/eslint-10 to master July 22, 2026 11:56
@xobotyi xobotyi closed this Jul 22, 2026
@xobotyi xobotyi reopened this Jul 22, 2026
@xobotyi
xobotyi merged commit 9fd2e5f into master Jul 22, 2026
4 checks passed
@xobotyi
xobotyi deleted the deps/vitest-4 branch July 22, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant