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();}Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark