Workers' testing package got a new name! @cloudflare/vitest-pool-workers is now @cloudflare/vitest-plugin
Hey friends, it's Shii! Today I've got a quiet but easy-to-miss announcement about Cloudflare Workers' testing setup, so let me walk you through it!
Cloudflare ChangelogWhat was announced?
According to Cloudflare's Changelog, the Workers Vitest integration package has officially been published as version 1 under the name @cloudflare/vitest-plugin. It was previously named @cloudflare/vitest-pool-workers, so this is a rename.
The story so far
Until now, if you wrote Vitest tests for Workers, you'd add @cloudflare/vitest-pool-workers as a dependency, import from it, and pull in its TypeScript type definitions. That mechanism itself hasn't changed — this announcement is purely about the package's name changing.
What changes
The Vitest configuration API itself is unchanged, so you don't need to rethink how you write tests or structure your config. However, existing projects do need to update three things.
- The dependency package name (
@cloudflare/vitest-pool-workers→@cloudflare/vitest-plugin) - Package imports in your code
- The TypeScript
typesentry
You could fix these by hand, but since the changes are spread across a few different spots, it's easy to miss one.
Dive Deep
If you want to migrate quickly, Cloudflare's codemod is the way to go. You can run @cloudflare/codemods vitest:pool-workers-to-vitest-plugin with npm, yarn, pnpm, or npx. Here's what it looks like with npx.
npx @cloudflare/codemods vitest:pool-workers-to-vitest-plugin
This codemod automatically updates your dependency, imports, and test TypeScript configuration all at once. If you'd rather walk through the steps yourself, there's also an official migration guide (Migrate to Vitest plugin).
On top of that, if you want to mock outbound requests in your Workers tests, the changelog points to the @msw/cloudflare integration. The details are covered in Cloudflare's docs (Mock outbound requests).
Wrap-up
- The Workers Vitest integration package has been renamed from
@cloudflare/vitest-pool-workersto@cloudflare/vitest-pluginas version 1 - The Vitest configuration API is unchanged; you only need to update the dependency name, imports, and the TypeScript
typesentry - A single codemod command from
@cloudflare/codemodshandles the migration automatically - The
@msw/cloudflareintegration can be used to mock outbound requests
If you're writing Workers tests with Vitest, it's worth running the codemod the next time you touch your project!