Cloudflare Docs
Workers
Edit this page on GitHub
Set theme to dark (⇧+D)

Vitest integration

Information about the Workers Vitest integration - the recommended package for writing unit and integration tests for Workers.

  • Get started: Install and set up the Workers Vitest integration - a tool for writing unit and integration tests for Workers and Pages Functions.
  • Recipes: Recipes are examples that help demonstrate how to write unit tests and integration tests for Workers projects using the @cloudflare/vitest-pool-workers package.
  • Configuration: The Workers Vitest integration provides additional configuration on top of Vitest’s usual options. To configure the Workers Vitest integration, use the poolOptions.workers key. Use the defineWorkersConfig() function from the …
  • Test APIs: The Workers Vitest integration provides runtime helpers for writing tests in the cloudflare:test module. The cloudflare:test module is provided by the @cloudflare/vitest-pool-workers package, but can only be imported from test files that execute in …
  • Isolation and concurrency: Review how the Workers Vitest integration runs your tests, how it isolates tests from each other, and how it imports modules.
  • Known issues: The Workers Vitest pool is currently in open-beta. These are issues Cloudflare is aware of and fixing: