⚠️ Miniflare's minimum supported Node.js version is now
16.13.0
. This was the first LTS release of Node.js 16.We recommend you use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8. Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.
Features
-
🎉 Add support for easily mocking outbound
fetch
requests. See 🕸 Web Standards for more details. Closes issue #162, thanks @william1616 for the PR.test("mocks fetch", async () => { // Get correctly set up `MockAgent` const fetchMock = getMiniflareFetchMock(); // Throw when no matching mocked request is found fetchMock.disableNetConnect(); // Mock request to https://example.com/thing const origin = fetchMock.get("https://example.com"); origin.intercept({ method: "GET", path: "/thing" }).reply(200, "Mocked response!"); const res = await fetch("https://example.com/thing"); const text = await res.text(); expect(text).toBe("Mocked response!"); });
-
🚽 Add support to immediately invoke ("flush") scheduled Durable Object alarms in the 🤹 Jest Environment. Closes issue #322, thanks @robertcepa and @CraigglesO for the PR.
test("flushes alarms", async () => { // Get Durable Object stub const env = getMiniflareBindings(); const id = env.TEST_OBJECT.newUniqueId(); const stub = env.TEST_OBJECT.get(id); // Schedule Durable Object alarm await stub.fetch("http://localhost/"); // Flush all alarms... await flushMiniflareDurableObjectAlarms(); // ...or specify an array of `DurableObjectId`s to flush await flushMiniflareDurableObjectAlarms([id]); });
-
🪣 Add support for R2 bucket bindings to the 🤹 Jest Environment. Closes issue #305, thanks @Cerberus for the PR.
-
2️⃣ Add support for Wrangler 2's
routes
property. Closes issue #254, thanks @jrencz for the PR. -
⚠️ Upgrade
undici
to5.9.1
. Thanks @yusukebe and @cameron-robey for the PRs.
Fixes
- Return custom
Content-Encoding
s, closes issue #312, thanks @vlovich. - Fix reading symlinked files from Miniflare's file-system storage. Closes issue #318, thanks @CraigglesO for the PR.
- Display all accessible addresses when listening on host
0.0.0.0
. Closes issue cloudflare/wrangler2#1652, thanks @Skye-31 for the PR. - Fix unbounded recursion when calling
Date.now()
/new Date()
without--actual-time
flag. Closes issue #314, thanks @WalshyDev and @AggressivelyMeows. - Preserve full path in
File#name
field. Thanks @yusefnapora for the PR. - Change underlying glob matching implementation to
picomatch
. Closes issue #244, thanks @jed and @cometkim for the PR. - Fix
NotSupportedError
when using theNODE-ED25519
algorithm in recent versions of Node.js. Closes issue #310, thanks @yusefnapora for the PR.