Skip to content

Update vitest to 5 #2151

Closed
Closed

Description

@kmcginnes

vitest and @vitest/coverage-v8 stayed on 4.1.11 in the latest dependency sweep. Both must move
together (5.0.0).

Blockers found

jest-dom matcher types no longer resolve — 172 error TS2339 across the test suite:
toBeInTheDocument, toBeDisabled, toBeChecked, toHaveAttribute, toHaveTextContent, and
toHaveValue all report "does not exist on type Assertion<void, HTMLElement>". vitest 5 changed the
Assertion type, so @testing-library/jest-dom's module augmentation no longer merges in. Needs the
setup file and/or tsconfig types wiring updated.

Order-dependent test failure surfaced — packages/graph-explorer-proxy-server/src/app.test.ts:311
intermittently expects status 400 and receives 200 during a full-suite run, while passing when the
file runs alone. vitest 5 reuses workers across files by default, so state that used to be isolated
per file now leaks. It reproduced once and passed on two subsequent full runs, so it's intermittent —
worth tracking down rather than waiting for it to bite CI.

Acceptance

pnpm checks and pnpm test pass with vitest and @vitest/coverage-v8 at 5.x, and the proxy server
app tests pass repeatably in a full-suite run.

Important

Internal only — this issue is maintained by the core team and is not accepting external contributions.

Activity

  1. added
    tech debtIssues, typically tasks, that are mainly about cleaning up code that is problematic in some way
    ready-for-agentfully specified, ready for an AFK agent
    internalSignals that the team will work on this issue internally.
    dependenciesPull requests that update a dependency file
    on Sep 10, 2026
  2. added theissue type on Sep 10, 2026
  3. kmcginnes commented on Sep 10, 2026

    @kmcginnes
    CollaboratorAuthor

    Related: #1853 is an open spike on an intermittent flake in the same app.test.ts. Its shared-mock hypothesis bears directly on the worker-reuse theory described above — vitest 5 reusing workers across files would expose exactly that kind of cross-file state leak. Worth reading the two together.

  4. mjuarros commented on Sep 18, 2026

    @mjuarros
    Contributor

    Correction to the second blocker in the description, surfaced while reviewing #2166.

    vitest 5 reuses workers across files by default, so state that used to be isolated per file now leaks.

    This isn't accurate. Isolation didn't change between the two versions — both default isolate: true. Confirmed by unpacking each package and reading configDefaults:

    isolate clearMocks
    4.1.11 true false
    5.0.0 true true

    Neither the migration guide nor the v5.0.0 release notes mention an isolation change. What v5 added is a reporter hint, printed only when isolate isn't set explicitly, which is almost certainly the source of the confusion. It shows up on every run of this suite:

    Isolate  220 workers spawned · ~297ms startup each (spawn + environment, per file)
             at least ~6.23s faster with isolate: false — reuses workers across files instead of one per file
    

    The "reuses workers across files" phrasing there describes what isolate: false would do, not what v5 now does. 220 workers for 220 files is per-file isolation working as before.

    The order-dependent app.test.ts:311 failure is real but pre-existing and unrelated to the upgrade — root-caused to an unawaited pipeline in app.ts and tracked in #2190.

    The actual v5 default flip in this table is clearMocks, which #2166 pins for the proxy server package.

  5. added this to the Release v3.3 milestone on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency fileinternalSignals that the team will work on this issue internally.ready-for-agentfully specified, ready for an AFK agenttech debtIssues, typically tasks, that are mainly about cleaning up code that is problematic in some way

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions