
3/15/2024 · Brendan Coll, Adam Murray
What this post added
Introduces a new Vitest integration for Cloudflare Workers, allowing tests to run directly within the `workerd` runtime. This enables more accurate unit and integration testing of Workers, including interactions with other Cloudflare Developer Platform products (KV, R2, D1, Queues, Service Bindings, Durable Objects). The integration leverages Vitest's custom pools feature to run the test runner inside `workerd`, using WebSockets for communication between the Node.js host and the `workerd` process. It also supports Node.js compatibility features via the `nodejs_compat` flag in `wrangler.toml`.