Skip to content
Cloudflare Docs

Testing

The Workers platform has a variety of ways to test your applications, depending on your requirements. We recommend using the Vitest integration, which allows for unit testing individual functions within your Worker. However, if you don't use Vitest, both Miniflare's API and the unstable_startWorker() API provide options for testing your Worker in any testing framework.

Write your first test

Testing comparison matrix

FeatureVitest integrationunstable_startWorker()Miniflare's API
Unit testingโœ…โŒโŒ
Integration testingโœ…โœ…โœ…
Loading Wrangler configuration filesโœ…โœ…โŒ
Use bindings directly in testsโœ…โŒโœ…
Isolated per-test storageโœ…โŒโŒ
Outbound request mockingโœ…โŒโœ…
Multiple Worker supportโœ…โœ…โœ…
Direct access to Durable Objectsโœ…โŒโŒ
Run Durable Object alarms immediatelyโœ…โŒโŒ
List Durable Objectsโœ…โŒโŒ
Testing service WorkersโŒโœ…โœ