Skip to content

docs: use @cloudflare/vitest-plugin for Cloudflare testing - #934

Merged
yusukebe merged 1 commit into
honojs:mainfrom
rafactx:docs/cloudflare-vitest-plugin
Nov 6, 2026
Merged

yusukebe merged 1 commit into
honojs:mainfrom
rafactx:docs/cloudflare-vitest-plugin

Conversation

@rafactx

@rafactx rafactx commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

The Cloudflare testing page uses defineWorkersProject from @cloudflare/vitest-pool-workers/config. That export, along with poolOptions, was removed in @cloudflare/vitest-pool-workers 0.13.0 (the Vitest 4 release), and the package has since been renamed to @cloudflare/vitest-plugin (npm marks the old name as deprecated). With current packages the documented vitest.config.ts doesn't load:

Error: Missing "./config" specifier in "@cloudflare/vitest-pool-workers" package

This PR:

  • switches the example to the cloudflareTest() plugin and wrangler.jsonc, which match the create-hono Workers template and Cloudflare's docs
  • imports env from cloudflare:workers, since env from cloudflare:test is deprecated
  • replaces the See Also links: the examples folder link was a 404, and the Miniflare 2 migration guide no longer applies
  • updates the package name in the testing guide and on the Workers getting started page, which now links to this example

I copied the snippets from the page into a fresh npm create hono@latest Workers project (hono 4.13.16, @cloudflare/vitest-plugin 1.6.0) and the test passes on Vitest 4.1.12 and 5.1.0. pnpm build and the Prettier check also pass.

Refs: https://developers.cloudflare.com/workers/testing/vitest-integration/migration-guides/migrate-to-vitest-plugin/

@yusukebe yusukebe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@yusukebe

yusukebe commented Nov 6, 2026

Copy link
Copy Markdown
Member

@rafactx

Thanks! This is helpful.

@yusukebe
yusukebe merged commit 20aab4e into honojs:main Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants