INTEGRITY Cloudflare Docs

Testing

The Workers platform provides complementary tools for testing different parts of your application. For most projects, use the Workers Vitest integration for unit tests and the createTestHarness() API for integration tests.

Unit tests

Use the Workers Vitest integration for fast feedback while testing individual functions and modules. Tests run inside the Workers runtime, so your test code can access bindings and runtime APIs directly.

The Workers Vitest integration provides:

To set up unit tests, refer to Write your first Vitest test.

Integration tests

Use the createTestHarness() API to exercise one or more Workers as a whole and test how they interact with each other and with external services.

The integration test harness provides:

To set up integration tests, refer to Get started with the integration test harness.