Skip to content

Get started

Testing Workers and Pages Functions within our Workers runtime can be challenging and requires additional manual setup. To address this, Cloudflare offers the Workers Vitest integration, which streamlines the process by providing a custom pool that lets your tests run directly inside the Workers runtime using Vitest. Vitest is a modern JavaScript testing framework with a wide range of features such as an instant watch mode, snapshot testing, code coverage, built-in TypeScript support, and seamless Jest compatibility.

The Workers Vitest integration:

  • Supports both unit tests and integration tests.
  • Provides direct access to Workers runtime APIs and bindings.
  • Implements isolated per-test storage.
  • Runs tests fully-locally using Miniflare.
  • Leverages Vitest's hot-module reloading for near instant reruns.
  • Provides a declarative interface for mocking outbound requests.
  • Supports projects with multiple Workers.

Get started with one of the available guides: