Skip to content

chore(cloudflare): migrate to @cloudflare/vitest-plugin - #1259

Open
sentry-junior[bot] wants to merge 3 commits into
mainfrom
chore/cloudflare-vitest-plugin
Open

sentry-junior[bot] wants to merge 3 commits into
mainfrom
chore/cloudflare-vitest-plugin

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Migrates Cloudflare worker tests off the renamed @cloudflare/vitest-pool-workers package to @cloudflare/vitest-plugin v1, and keeps the local Wrangler CLI pin safe for smoke.

Why
Cloudflare published @cloudflare/vitest-plugin as the replacement for @cloudflare/vitest-pool-workers. The new stack also recommends @msw/cloudflare for outbound request mocks.

App-level wrangler@4.125.0 still breaks local smoke for this Worker: early routes work, then the process dies around /.well-known/oauth-authorization-server with an empty ERROR (ECONNRESETECONNREFUSED). The Vitest plugin can keep its newer internal Wrangler; the app CLI stays on 4.80.0 until a newer release keeps smoke green.

What changed

  • Swap catalog/deps to @cloudflare/vitest-plugin@1.0.0, add @msw/cloudflare, update MSW handlers
  • Replace Miniflare fetchMock with @msw/cloudflare network mocks in mcp-cloudflare
  • Keep app CLI catalog pin at wrangler@4.80.0
  • Harden local smoke workflow readiness checks and document the pin/upgrade path

Verification

  • pnpm --filter @sentry/mcp-cloudflare test → 32 files / 419 tests passed
  • pnpm --filter @sentry/mcp-cloudflare tsc → clean
  • Local smoke on wrangler@4.80.0 green after pin
  • Reproduced wrangler@4.125.0 mid-smoke abort; left pin in place

Refs: https://developers.cloudflare.com/changelog/post/2026-08-19-vitest-plugin/
Docs: docs/cloudflare/wrangler-pin.md

Requested by David Cramer.

--

View Junior Session [Sentry]

Replace the deprecated vitest-pool-workers package with the new Vitest
plugin and move Cloudflare worker tests onto @msw/cloudflare. Extract
shared MSW handlers so Workers tests can reuse them without msw/node.

Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer marked this pull request as ready for review August 22, 2026 06:36
The Vitest plugin can use its own newer Wrangler dependency. Keep the app
CLI pinned to 4.80 because 4.125 crashes during the local smoke workflow.
Keep the app CLI on Wrangler 4.80 until 4.125 stops aborting mid-smoke.
Document the pin and tighten smoke readiness checks so upgrades fail
loudly instead of flaking on OAuth metadata routes.

Co-Authored-By: David Cramer <david@sentry.io>
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.

0 participants