Patch Changes
-
#1819
d8a18070
Thanks @CarmenPopoviciu! - Adds support for custom _routes.json when runningwrangler pages dev
-
#1815
d8fe95d2
Thanks @cameron-robey! - feat: testing scheduled events withwrangler dev
remote modeUsing the new middleware (#1735), we implement a way of testing scheduled workers from a fetch using
wrangler dev
in remote mode, by passing a new command line flag--test-scheduled
. This exposes a route/__scheduled
which will trigger the scheduled event.$ npx wrangler dev index.js --test-scheduled $ curl http://localhost:8787/__scheduled
Closes #570
-
#1801
07fc90d6
Thanks @rozenmd! - feat: multi-worker testingThis change introduces the ability to test multi-worker setups via the wrangler API's unstable_dev function.
Usage:
import { unstable_dev } from "wrangler"; /** * Note: if you shut down the first worker you spun up, * the parent worker won't know the child worker exists * and your tests will fail */ describe("multi-worker testing", () => { let childWorker; let parentWorker; beforeAll(async () => { childWorker = await unstable_dev( "src/child-worker.js", { config: "src/child-wrangler.toml" }, { disableExperimentalWarning: true } ); parentWorker = await unstable_dev( "src/parent-worker.js", { config: "src/parent-wrangler.toml" }, { disableExperimentalWarning: true } ); }); afterAll(async () => { await childWorker.stop(); await parentWorker.stop(); }); it("childWorker should return Hello World itself", async () => { const resp = await childWorker.fetch(); if (resp) { const text = await resp.text(); expect(text).toMatchInlineSnapshot(`"Hello World!"`); } }); it("parentWorker should return Hello World by invoking the child worker", async () => { const resp = await parentWorker.fetch(); if (resp) { const parsedResp = await resp.text(); expect(parsedResp).toEqual("Parent worker sees: Hello World!"); } }); });
-
#1865
adfc52d6
Thanks @JacobMGEvans! - polish: loglevel flag
Added a '--log-level' flag that allows the user to specify between 'debug', 'info', 'log', 'warning', 'error', 'none'
Currently 'none' will turn off all outputs in Miniflare (local mode), however, Wrangler will still output Errors.resolves #185
-
#1861
3d51d553
Thanks @GregBrimble! - fix: Add 'charset' to 'Content-Type' on 'wrangler pages dev' responses -
#1867
5a6ccc58
Thanks @cameron-robey! - fix: handle logging of empty map/set/weak-map/weak-set -
#1882
ba0aed63
Thanks @rozenmd! - chore: refactor remote.tsx to only destructure when necessary