
Cloudflare Workers Testing
This is a complete testing setup for Cloudflare Workers using Vitest 2.1.8 and the official @cloudflare/vitest-pool-workers 0.7.2. It covers the full workflow: configuring the test pool, accessing real bindings through cloudflare:test (D1, KV, R2, Durable Objects, Queues, AI), handling execution contexts properly with waitOnExecutionContext, and setting up isolated storage per test. The critical rules section is worth your time because it shows the exact mistakes people make, like forgetting to wait on context or trying to mock env manually instead of using the provided module. Updated for the January 2025 breaking changes in Miniflare v3, so you won't be chasing outdated syntax.
- skills.sh installs
- 340
- GitHub stars
- 248
- last updated
- Aug 21, 2026
Install
$ npx -y skills add secondsky/claude-skills --skill cloudflare-workers-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
Cloudflare Workers Testing with Vitest
Status: ✅ Production Ready | Last Verified: 2025-01-27 Vitest: ^2.0.0 | @cloudflare/vitest-pool-workers: 0.7.2 | Miniflare: Latest
Table of Contents
- What Is Workers Testing?
- New in 2025
- Quick Start (5 Minutes)
- Critical Rules
- Core Concepts
- Top 5 Use Cases
- Best Practices
- Top 8 Errors Prevented
- When to Load References
What Is Workers Testing?
Testing Cloudflare Workers with Vitest and @cloudflare/vitest-pool-workers enables writing unit and integration tests that run in a real Workers environment with full binding support (D1, KV, R2, Durable Objects, Queues, AI). Tests execute in Miniflare for local development and can run in CI/CD with actual Workers runtime behavior.
Key capabilities: Binding mocks, execution context testing, edge runtime simulation, coverage tracking, fast test execution.
New in 2025
Sponsors
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Testing & QA, Documentation, Cloud & Infrastructure
- First seen
- Jun 3, 2026
More from secondsky/claude-skills
All 146- Bun Cloudflare Workers338
- Bun Test Coverage337
- Bun Http Server336
- Bun Test Mocking335
- Nuxt Seo335
- Bun Bundler334
- Bun Workers333
- Bun Shell331
- Bun React Ssr330
- Bun Tanstack Start329
- Cloudflare Workers Performance329
- Bun Hot Reloading328
- Bun Redis328
- Bun Ffi326
- Bun Jest Migration326
- Bun Websocket Server326
- Cloudflare Workers Runtime Apis326
- Swift Best Practices326
- Bun Nuxt323
- Bun Macros322
- Cloudflare Workers Frameworks321
- Supabase Postgres Best Practices319
- Cloudflare Workers Ci Cd318
- Cloudflare Workers Dev Experience317