|
1 | 1 | # 🚧 Changelog |
2 | 2 |
|
| 3 | +# 2.7.0 |
| 4 | + |
| 5 | +> ⚠️ **Miniflare's minimum supported Node.js version is now `16.13.0`.** This |
| 6 | +> was the first LTS release of Node.js 16. |
| 7 | +> |
| 8 | +> We recommend you use the latest Node.js version if possible, as Cloudflare |
| 9 | +> Workers use a very up-to-date version of V8. Consider using a Node.js version |
| 10 | +> manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm. |
| 11 | +
|
| 12 | +### Features |
| 13 | + |
| 14 | +- 🎉 Add support for easily **mocking outbound `fetch` requests**. See |
| 15 | + [🕸 Web Standards](https://miniflare.dev/core/standards#mocking-outbound-fetch-requests) |
| 16 | + for more details. Closes |
| 17 | + [issue #162](https://github.com/cloudflare/miniflare/issues/162), thanks |
| 18 | + [@william1616](https://github.com/william1616) for |
| 19 | + [the PR](https://github.com/cloudflare/miniflare/pull/293). |
| 20 | + |
| 21 | + ```js |
| 22 | + test("mocks fetch", async () => { |
| 23 | + // Get correctly set up `MockAgent` |
| 24 | + const fetchMock = getMiniflareFetchMock(); |
| 25 | + // Throw when no matching mocked request is found |
| 26 | + fetchMock.disableNetConnect(); |
| 27 | + // Mock request to https://example.com/thing |
| 28 | + const origin = fetchMock.get("https://example.com"); |
| 29 | + origin |
| 30 | + .intercept({ method: "GET", path: "/thing" }) |
| 31 | + .reply(200, "Mocked response!"); |
| 32 | + |
| 33 | + const res = await fetch("https://example.com/thing"); |
| 34 | + const text = await res.text(); |
| 35 | + expect(text).toBe("Mocked response!"); |
| 36 | + }); |
| 37 | + ``` |
| 38 | + |
| 39 | +- 🚽 Add support to immediately invoke _("flush")_ scheduled Durable Object |
| 40 | + alarms in the [🤹 Jest Environment](https://miniflare.dev/testing/jest). |
| 41 | + Closes [issue #322](https://github.com/cloudflare/miniflare/issues/322), |
| 42 | + thanks [@robertcepa](https://github.com/robertcepa) and |
| 43 | + [@CraigglesO](https://github.com/CraigglesO) for |
| 44 | + [the PR](https://github.com/cloudflare/miniflare/pull/324). |
| 45 | + |
| 46 | + ```js |
| 47 | + test("flushes alarms", async () => { |
| 48 | + // Get Durable Object stub |
| 49 | + const env = getMiniflareBindings(); |
| 50 | + const id = env.TEST_OBJECT.newUniqueId(); |
| 51 | + const stub = env.TEST_OBJECT.get(id); |
| 52 | + |
| 53 | + // Schedule Durable Object alarm |
| 54 | + await stub.fetch("http://localhost/"); |
| 55 | + |
| 56 | + // Flush all alarms... |
| 57 | + await flushMiniflareDurableObjectAlarms(); |
| 58 | + // ...or specify an array of `DurableObjectId`s to flush |
| 59 | + await flushMiniflareDurableObjectAlarms([id]); |
| 60 | + }); |
| 61 | + ``` |
| 62 | + |
| 63 | +- 🪣 Add support for R2 bucket bindings to the |
| 64 | + [🤹 Jest Environment](https://miniflare.dev/testing/jest). Closes |
| 65 | + [issue #305](https://github.com/cloudflare/miniflare/issues/305), thanks |
| 66 | + [@Cerberus](https://github.com/Cerberus) for |
| 67 | + [the PR](https://github.com/cloudflare/miniflare/pull/306). |
| 68 | +- 2️⃣ Add support for Wrangler 2's `routes` property. Closes |
| 69 | + [issue #254](https://github.com/cloudflare/miniflare/issues/254), thanks |
| 70 | + [@jrencz](https://github.com/jrencz) for |
| 71 | + [the PR](https://github.com/cloudflare/miniflare/pull/307). |
| 72 | +- ⚠️ Upgrade [`undici`](https://github.com/nodejs/undici) to |
| 73 | + [`5.9.1`](https://github.com/nodejs/undici/releases/tag/v5.9.1). Thanks |
| 74 | + [@yusukebe](https://github.com/yusukebe) and |
| 75 | + [@cameron-robey](https://github.com/cameron-robey) for |
| 76 | + [the](https://github.com/cloudflare/miniflare/pull/320) |
| 77 | + [PRs](https://github.com/cloudflare/miniflare/pull/333). |
| 78 | + |
| 79 | +### Fixes |
| 80 | + |
| 81 | +- Return custom `Content-Encoding`s, closes |
| 82 | + [issue #312](https://github.com/cloudflare/miniflare/issues/312), thanks |
| 83 | + [@vlovich](https://github.com/vlovich). |
| 84 | +- Fix reading symlinked files from Miniflare's file-system storage. Closes |
| 85 | + [issue #318](https://github.com/cloudflare/miniflare/issues/318), thanks |
| 86 | + [@CraigglesO](https://github.com/CraigglesO) for |
| 87 | + [the PR](https://github.com/cloudflare/miniflare/pull/319). |
| 88 | +- Display all accessible addresses when listening on host `0.0.0.0`. Closes |
| 89 | + [issue cloudflare/wrangler2#1652](https://github.com/cloudflare/wrangler2/issues/1652), |
| 90 | + thanks [@Skye-31](https://github.com/Skye-31) for |
| 91 | + [the PR](https://github.com/cloudflare/miniflare/pull/332). |
| 92 | +- Fix unbounded recursion when calling `Date.now()`/`new Date()` without |
| 93 | + `--actual-time` flag. Closes |
| 94 | + [issue #314](https://github.com/cloudflare/miniflare/issues/314), thanks |
| 95 | + [@WalshyDev](https://github.com/WalshyDev) and |
| 96 | + [@AggressivelyMeows](https://github.com/AggressivelyMeows). |
| 97 | +- Preserve full path in `File#name` field. Thanks |
| 98 | + [@yusefnapora](https://github.com/yusefnapora) for |
| 99 | + [the PR](https://github.com/cloudflare/miniflare/pull/309). |
| 100 | +- Change underlying glob matching implementation to `picomatch`. Closes |
| 101 | + [issue #244](https://github.com/cloudflare/miniflare/issues/244), thanks |
| 102 | + [@jed](https://github.com/jed) and [@cometkim](https://github.com/cometkim) |
| 103 | + for [the PR](https://github.com/cloudflare/miniflare/pull/316). |
| 104 | +- Fix `NotSupportedError` when using the `NODE-ED25519` algorithm in recent |
| 105 | + versions of Node.js. Closes |
| 106 | + [issue #310](https://github.com/cloudflare/miniflare/issues/310), thanks |
| 107 | + [@yusefnapora](https://github.com/yusefnapora) for |
| 108 | + [the PR](https://github.com/cloudflare/miniflare/pull/311). |
| 109 | + |
3 | 110 | ## 2.6.0 |
4 | 111 |
|
5 | 112 | ### Features |
|
0 commit comments