Cloudflare Docs
Workers
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Testing

Review the tools available for testing and debugging Workers.

  • Local development: Develop your Workers locally via Wrangler.
  • Unit testing: Test independent units of your Worker by importing them into your tests.
  • Integration testing: Test multiple units of your Worker working together.
  • Debugging tools: Debug your local and deployed Workers using a variety of tools.
  • Vitest integration: Information about the Workers Vitest integration - the recommended package for writing unit and integration tests for Workers.

​​ Testing comparison matrix

FeatureVitest Poolunstable_dev()Miniflare’s API
Unit testing
Integration testing
Loading Wrangler configuration files
Bindings directly in tests
Isolated per-test storage
Outbound request mocking
Multiple Worker support🚧1
Direct access to Durable Object instances
Run Durable Object alarms immediately
List Durable Objects
Testing service Workers

  1. Support for multiple Workers in unstable_dev() relies on wrangler dev’s service registry which can be unreliable when running multiple tests in parallel. ↩︎