← Workers / workers / testing / vitest-integration / migration-guides
Migrate to Vitest plugin
@cloudflare/vitest-plugin replaces @cloudflare/vitest-pool-workers. The package API and Vitest configuration are unchanged.
Run the codemod
To update your project automatically, run the following command from the project root:
npx @cloudflare/codemods vitest:pool-workers-to-vitest-pluginUse --dry-run to preview the changes. Use --files <glob> to limit the files the codemod updates.
The codemod updates your dependency, imports, and test TypeScript configuration.
Update manually
If you cannot run the codemod, update the package name in your package.json, imports, and test tsconfig.json:
- "@cloudflare/vitest-pool-workers": "^0.16.0"
+ "@cloudflare/vitest-plugin": "^1.0.0"
- import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
+ import { cloudflareTest } from "@cloudflare/vitest-plugin";
- "types": ["@cloudflare/vitest-pool-workers/types"]
+ "types": ["@cloudflare/vitest-plugin/types"]The same rename applies to subpath imports, including @cloudflare/vitest-plugin/config.
Update request mocking
To mock outbound requests, use @msw/cloudflare ↗. For setup instructions, refer to Mock outbound requests.