Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Cloudflare Docs
Log in

unstable_startWorker() is an experimental API subject to breaking changes.

If you do not want to use Vitest, consider usingWrangler'sunstable_startWorker() API. This API exposes the internals of Wrangler's dev server, and allows you to customise how it runs. Compared to usingMiniflare directly for testing, you can pass in a Wrangler configuration file, and it will automatically load the configuration for you.

This example usesnode:test, but should apply to any testing framework:

TypeScript
importassert from"node:assert";
importtest,{after,before,describe} from"node:test";
import{unstable_startWorker} from"wrangler";
describe("worker",()=>{
letworker;
before(async()=>{
worker=awaitunstable_startWorker({ config:"wrangler.json"});
});
test("hello world",async()=>{
assert.strictEqual(
await (awaitworker.fetch("http://example.com")).text(),
"Hello world",
);
});
after(async()=>{
awaitworker.dispose();
});
});

[8]
ページ先頭

©2009-2026 Movatter.jp