Skip to content
Cloudflare Docs

unstable_startWorker()

note: we recommend using vitest

If you do not want to use Vitest and would like to write integration tests for a single Worker, consider using Wrangler's unstable_startWorker() API. This API exposes the internals of Wrangler's dev server, and allows you to customise how it runs.

import assert from "node:assert";
import { unstable_startWorker } from "wrangler";
const worker = await unstable_startWorker({ config: "wrangler.json" });
try {
const response = await worker.fetch("/?a=1&b=2");
assert.strictEqual(await response.text(), "3");
} finally {
await worker.dispose();
}