Skip to content

Move to Vitest 5 and @cloudflare/vitest-plugin 1.4.0 - #19

Merged
vhata merged 3 commits into
mainfrom
todo/bump-vitest-to-five
Nov 9, 2026
Merged

vhata merged 3 commits into
mainfrom
todo/bump-vitest-to-five

Conversation

@vhata

@vhata vhata commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Why

The phase-1 plan specified Vitest 5, but the project was pinned to
Vitest ^4.1 because @cloudflare/vitest-plugin 1.3.7, the newest
version the release-age gate allowed at the time, supported only
Vitest 4 and its workerd pool would not start under 5.
@cloudflare/vitest-plugin 1.4.0 declares vitest: ^4.1.0 || ^5.0.0,
so the pin can move.

What changed

  • vitest moves from ^4.1.11 to ^5.0.4 and @cloudflare/vitest-plugin
    from ^1.3.7 to ^1.4.0. The lockfile drops the plugin's old private
    copies of wrangler 4.148.0, esbuild 0.28.1 and zod 4.4.3, and the
    @vitest/* packages Vitest 5 no longer splits out. Plugin 1.4.0
    depends on exactly wrangler 4.149.0 and miniflare
    5.20261006.1-alpha, which the existing release-age exclusions in
    pnpm-workspace.yaml already cover; no exclusion was added.
  • The worker test project sets fsModuleCache: false. Vitest 5 turns
    the on-disk module cache on by default and hands the runner paths to
    cached transformed modules; workerd cannot read the host filesystem,
    so all three worker suites failed with readAll: no such file or directory. The upstream fix is [vitest-plugin] Fix filesystem module caching cloudflare/workers-sdk#16163, still
    open; the issue filed for this failure, #16237, was closed as a
    duplicate of the report on #16132, not because a fix shipped. Core
    and client keep the cache. The config comment and a new
    docs/DECISIONS.md row say to drop the override once a plugin
    release reads the cache in the Node pool, and a new TODO.md entry
    tracks that.
  • The docs/DECISIONS.md row on --passWithNoTests=false no longer
    names Vitest 4; Vitest 5 also fails on empty collection by default.
  • No test or source file needed a change. The breaking changes in the
    Vitest 5 migration guide were checked against the tests: the only
    mocks are per-test vi.fn() (unaffected by clearMocks now
    defaulting on), and nothing uses toThrow(''), sequential,
    expect.poll, unawaited resolves/rejects, bench, worker ids or
    removed entrypoints.

Type: tooling
Resolves TODO: bump-vitest-to-five
Files TODO: drop-worker-fs-module-cache-override

Validation

  • bash scripts/check.sh before the bump: pass. 20 files, 129 tests:
    core 15 files / 104 tests, worker 3 / 19, client 2 / 6 (per-project
    counts from bash scripts/test.sh --reporter=json).
  • Bump without the config change: worker 3 files collected 0 tests
    and failed with the readAll error, on cold and warm caches; core
    and client passed (110 tests).
  • With fsModuleCache: false on the worker project, after deleting
    node_modules/.vitest-cache: core 15 / 104, worker 3 / 19,
    client 2 / 6, all passing, identical to the baseline.
  • bash scripts/test.sh test/does-not-exist: exit 1, so empty
    collection still fails the gate.
  • pnpm install --frozen-lockfile: lockfile up to date.
  • bash scripts/check.sh (fmt-check, lint, typecheck, test): pass.
  • bash scripts/build.sh: pass.
  • bash docket/scripts/check-queues.sh --strict: no errors.
  • Not checked: CI on Linux, pnpm dev, and coverage (the project has
    no coverage run; 🐛 BUG: vitest-plugin coverage shim doesn't handle __vitest_stopV8Coverage under vitest 5 cloudflare/workers-sdk#16238 reports a separate
    plugin bug with V8 coverage under Vitest 5).

@vhata vhata added docket Made under the Docket workflow type:tooling Docket change type: tooling queue:todo Docket: claims or resolves TODO.md work area:tooling Docket queue area [TOOLING] priority:p3 Docket queue priority P3 labels Oct 13, 2026
@vhata
vhata marked this pull request as ready for review October 13, 2026 23:22
vhata added a commit that referenced this pull request Oct 14, 2026
Adds the discoveries reported by the writers and reviewers of PRs #13,
#15, #18 and #19, and moves blame-ignore-biome-reformat to Ready now
that PR #9 has landed.
vhata added 3 commits October 13, 2026 17:08
Vitest 5 enables the on-disk module cache by default, and the plugin
hands workerd cache file paths it cannot read, so the worker project
turns fsModuleCache off until the plugin reads the cache in the pool.
@vhata
vhata force-pushed the todo/bump-vitest-to-five branch from bcaf9a6 to 3e9c16f Compare October 14, 2026 00:09
@vhata

vhata commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

Review

Independent review by a Claude Opus 5.5 reviewer agent at f83973e:
approve with nits. Verified: without the override, every worker
suite fails with readAll: no such file or directory on cold and
warm caches; the upstream issues exist and say what is claimed;
pnpm install --frozen-lockfile passes; a fresh resolve under the
release-age gate picks the same versions and nothing else moves;
per-project counts match origin/main (core 15/104, worker 3/19,
client 2/6) with identical test names; an empty collection still
fails; bash scripts/check.sh and bash scripts/build.sh pass.
Findings: 2. The cited issue #16237 had been closed as a duplicate,
so the docs now name the open fix #16163 (bcaf9a6, checked by the
coordinator). Plugin 1.4.1 does not yet carry that fix; no change
needed. Not checked: CI on Linux, pnpm dev, coverage.

@vhata
vhata merged commit 314e84b into main Nov 9, 2026
4 checks passed
@vhata
vhata deleted the todo/bump-vitest-to-five branch November 9, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tooling Docket queue area [TOOLING] docket Made under the Docket workflow priority:p3 Docket queue priority P3 queue:todo Docket: claims or resolves TODO.md work type:tooling Docket change type: tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant