Skip to content

[vitest-plugin] Vitest 5 support - #16132

Merged
edmundhung merged 21 commits into
mainfrom
edmundhung/vitest-module-fallback-compat
Oct 8, 2026
Merged

edmundhung merged 21 commits into
mainfrom
edmundhung/vitest-module-fallback-compat

Conversation

@edmundhung

@edmundhung edmundhung commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Superseded #15500.

This adds Vitest 5 support to @cloudflare/vitest-plugin without the need to drop legacy module registry support.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: I will follow up on docs update next.

@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 30bf090

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vitest-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ask-bonk

ask-bonk Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@edmundhung
edmundhung changed the base branch from penalosa/vitest-5 to main October 7, 2026 11:21
@edmundhung
edmundhung changed the base branch from main to penalosa/vitest-5 October 7, 2026 11:32
@edmundhung
edmundhung changed the base branch from penalosa/vitest-5 to main October 7, 2026 11:36
@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16132

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16132

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16132

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16132

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16132

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16132

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16132

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16132

miniflare

npm i https://pkg.pr.new/miniflare@16132

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16132

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16132

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16132

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16132

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16132

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16132

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16132

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16132

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16132

wrangler

npm i https://pkg.pr.new/wrangler@16132

commit: 30bf090

@edmundhung
edmundhung force-pushed the edmundhung/vitest-module-fallback-compat branch from f31e4ef to fdc74c2 Compare October 7, 2026 18:42
Keep the existing legacy module registry default, V1 fallback protocol,
and Vitest 4 behavior while supporting Vitest 5. Cover both registry
modes and Vitest versions, including the examples fixture running Vitest
5.
@edmundhung
edmundhung force-pushed the edmundhung/vitest-module-fallback-compat branch 3 times, most recently from ff57d15 to 6eb9e54 Compare October 7, 2026 20:16
@edmundhung
edmundhung force-pushed the edmundhung/vitest-module-fallback-compat branch from 6eb9e54 to f91708c Compare October 7, 2026 20:30
@edmundhung edmundhung changed the title [vitest-plugin] Explore compatibility [vitest-plugin] Vitest 5 support Oct 7, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@edmundhung
edmundhung merged commit 08d694c into main Oct 8, 2026
63 checks passed
@edmundhung
edmundhung deleted the edmundhung/vitest-module-fallback-compat branch October 8, 2026 11:04
@edmundhung edmundhung mentioned this pull request Oct 8, 2026
2 of 5 tasks
@mattjohnsonpint

mattjohnsonpint commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This is great! But it looks like it doesn't yet work with fsModuleCache: true. See previous comments from @marshallswain at #15500 (comment)

@edmundhung

Copy link
Copy Markdown
Member Author

@mattjohnsonpint Looking into it. I will put up a patch once I figure out the issue.

brandhaug added a commit to brandhaug/b2b-saas-starter that referenced this pull request Oct 9, 2026
## Outcome

Upgrade the workspace and pinned CI installer from Vite+ 0.3.0 to 1.0.0,
including Vite 8.3.1, Vitest/coverage 5.0.1, Oxlint 1.85.0 and Oxfmt
0.70.0.

The official migrator aligns catalogs, overrides and dependencies,
removes redundant direct runner/linter dependencies, and moves task
inputs under `cache`. Follow-up fixes preserve external coverage
matching, run lint-rule fixtures through the bundled linter, restore
Fallow test discovery, and address new lint diagnostics without changing
application behavior. The Node engine range matches the supported
runtime majors; pinned Node 24.21.0 is unchanged. CI uses the release's
immutable installer commit and verified SHA-256, and its managed pnpm
shim replaces the removed Corepack shim.

Resolve the Cloudflare worker-test blocker by replacing
`@cloudflare/vitest-pool-workers@0.22.0` with
`@cloudflare/vitest-plugin@1.4.0`. The released plugin supports Vitest 5
through
[workers-sdk#16132](cloudflare/workers-sdk#16132),
addressing
[workers-sdk#15618](cloudflare/workers-sdk#15618).
Update imports and type references, use the plugin's exported queue
message/result types, and remove the old runtime overrides and
unnecessary `clearMocks: false` settings. Both real-worker suites now
execute successfully. Merge current master while preserving its
dependency and security updates.

Reviewed the [Vite+
release](https://github.com/voidzero-dev/vite-plus/releases/tag/v1.0.0),
[migration rules](https://viteplus.dev/guide/migrate-rules), [Vitest
compatibility guide](https://viteplus.dev/guide/vitest-v5), [Vitest 5
migration](https://vitest.dev/guide/migration/), and [tsdown 0.23
release](https://github.com/rolldown/tsdown/releases/tag/v0.23.0). This
repo has no `vp pack` configuration to migrate.

## Validation

Local validation on the tree committed as `95f56622`:

- `vp install --frozen-lockfile` passes.
- `pnpm -C apps/background test` passes: 18 files, 134 tests, including
both previously blocked real-worker suites.
- `E2E_PORT=3197 pnpm run validate` passes: type checking, lint,
formatting, Fallow, unused-message checks, workspace/script tests,
production builds, generated Wrangler drift detection, local D1
migration/seed, and browser E2E.
- Browser artifact: `apps/web/playwright-report/results.json` reports 62
expected passes, zero failures, retries or skips. Reproduce with
`E2E_PORT=3197 pnpm run validate`.
- Independent targeted reviews found no actionable issues in the
migration, merge integration, or final queue type changes.

All required checks passed on `db576b21`, including the previously
blocked package tests. CI on `95f56622` is pending. This follow-up pins
the global `sharp` override to patched 0.35.5 so the new plugin's
runtime cannot resolve vulnerable 0.35.4. Full local validation and
frozen-lockfile installation pass again; independent review found no
issues.

## Risks and remaining work

Await CI on the new head. The upstream Vitest compatibility blocker is
resolved locally and in CI. Background projects retain separate Vite
servers and explicit configuration isolation.

Audit still has an external blocker: `braces@3.0.3` is affected by
[CVE-2026-93687](GHSA-vfj7-8cjw-p6xm),
with no published patched release. The same version is already in
master's lockfile. No exception or suppression was added. The other
finding, `sharp@0.35.4`, is removed in `95f56622`.
kixelated added a commit to kixel-ai/quest that referenced this pull request Oct 14, 2026
@cloudflare/vitest-plugin 1.3.6 supports only vitest ^4.1.0 and relies
on internal Vitest APIs, so under vitest 5 every Workers pool failed to
start with "SyntaxError: Unexpected identifier 'file'". Vitest 5
support landed in 1.4.0 (cloudflare/workers-sdk#16132).

Bump the plugin to 1.4.2 and wrangler to 4.151.0, the version the plugin
pins, so one wrangler/miniflare/workerd is installed. Regenerate the
Worker runtime types for the newer workerd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit to kixel-ai/quest that referenced this pull request Oct 14, 2026
…#96)

* chore(deps-dev): bump the npm group across 1 directory with 4 updates

Bumps the npm group with 4 updates in the / directory: [esbuild](https://github.com/evanw/esbuild), [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest), [@cloudflare/vitest-plugin](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/vitest-plugin) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler).


Updates `esbuild` from 0.28.1 to 0.28.2
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](evanw/esbuild@v0.28.1...v0.28.2)

Updates `vitest` from 4.1.11 to 5.0.3
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v5.0.3/packages/vitest)

Updates `@cloudflare/vitest-plugin` from 1.3.5 to 1.3.6
- [Release notes](https://github.com/cloudflare/workers-sdk/releases)
- [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/vitest-plugin/CHANGELOG.md)
- [Commits](https://github.com/cloudflare/workers-sdk/commits/@cloudflare/vitest-plugin@1.3.6/packages/vitest-plugin)

Updates `wrangler` from 4.146.0 to 4.147.0
- [Release notes](https://github.com/cloudflare/workers-sdk/releases)
- [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.147.0/packages/wrangler)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-version: 0.28.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: vitest
  dependency-version: 5.0.3
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: "@cloudflare/vitest-plugin"
  dependency-version: 1.3.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: wrangler
  dependency-version: 4.147.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): bump @cloudflare/vitest-plugin for Vitest 5

@cloudflare/vitest-plugin 1.3.6 supports only vitest ^4.1.0 and relies
on internal Vitest APIs, so under vitest 5 every Workers pool failed to
start with "SyntaxError: Unexpected identifier 'file'". Vitest 5
support landed in 1.4.0 (cloudflare/workers-sdk#16132).

Bump the plugin to 1.4.2 and wrangler to 4.151.0, the version the plugin
pins, so one wrangler/miniflare/workerd is installed. Regenerate the
Worker runtime types for the newer workerd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luke Curley <kixelated@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
jsanchez542-hub added a commit to jsanchez542-hub/maitre that referenced this pull request Oct 16, 2026
… to the plugin that reads Vitest 5.0.4's module cache

Dependabot's group paired Vitest 5.0.4 with test plugin 1.4.1, which fails every
test file on the module cache Vitest 5.0.4 turns on (cloudflare/workers-sdk#16132,
fixed in 1.4.3). Wrangler 4.151.1, plugin 1.4.4, Vitest 5.0.4 and today's
Workers types pass the 69 tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants