Cloudflare has announced a new Workers Vitest integration that allows developers to write unit and integration tests for Cloudflare Workers. This integration provides the ability to run tests within the same runtime as Cloudflare Workers in production, allowing for greater confidence in the behavior of Workers when deployed.
•13m read time• From blog.cloudflare.com
Table of contents
Get started testing Workers with VitestTest anything exported from a WorkerBetter testing experience === better testingHow Vitest traditionally worksSolving the problem with custom poolsDynamic code evaluationDurable Objects as test runnersIntegration tests with hot-module-reloadingIsolated per-test storageDeclarative request mockingTesting Durable Objects directlyTry it out!Sort: