Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 07f3122

Browse files
committed
Bump versions to 2.11.0, update CHANGELOG.md and docs
1 parent 1a21f6b commit 07f3122

File tree

29 files changed

+449
-382
lines changed

29 files changed

+449
-382
lines changed

docs/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# 🚧 Changelog
22

3+
## 2.11.0
4+
5+
### Features
6+
7+
- Add support for dead-letter queues. Thanks
8+
[@jbw1991](https://github.com/jbw1991) for
9+
[the PR](https://github.com/cloudflare/miniflare/pull/411).
10+
- Add `getMiniflareDurableObjectIds()` global function to Miniflare's
11+
Jest/Vitest environments for listing active Durable Objects. Calling
12+
`getMiniflareDurableObjectIds("TEST_OBJECT")` will return a `Promise` that
13+
resolves to an array of active `DurableObjectId`s for the `TEST_OBJECT`
14+
namespace. Closes
15+
[issue #384](https://github.com/cloudflare/miniflare/issues/384), thanks
16+
[@DaniFoldi](https://github.com/DaniFoldi) for
17+
[the PR](https://github.com/cloudflare/miniflare/pull/413).
18+
19+
### Fixes
20+
21+
- Strip quotes from R2 `onlyIf` header values. Closes
22+
[issue #402](https://github.com/cloudflare/miniflare/issues/402), thanks
23+
[@vincentbernat](https://github.com/vincentbernat) and
24+
[@CraigglesO](https://github.com/CraigglesO) for
25+
[the PR](https://github.com/cloudflare/miniflare/pull/403).
26+
- Disable `r2Persist` option in Miniflare's Jest/Vitest environments. Thanks
27+
[@hanford](https://github.com/hanford) for
28+
[the PR](https://github.com/cloudflare/miniflare/pull/414).
29+
330
## 2.10.0
431

532
### Features

docs/src/content/testing/jest.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,24 @@ test("flushes alarms", async () => {
264264
});
265265
```
266266
267+
To list all active Durable Objects in a namespace, use the
268+
`getMiniflareDurableObjectIds()` global function:
269+
270+
```js
271+
test("gets objects", async () => {
272+
// Get Durable Object stub
273+
const env = getMiniflareBindings();
274+
const id = env.TEST_OBJECT.newUniqueId();
275+
const stub = env.TEST_OBJECT.get(id);
276+
await stub.fetch("http://localhost/");
277+
278+
// Get all active TEST_OBJECT Durable Object IDs
279+
const ids = await getMiniflareDurableObjectIds("TEST_OBJECT");
280+
expect(ids).toHaveLength(1);
281+
expect(ids[0].toString()).toBe(id.toString());
282+
});
283+
```
284+
267285
### Constructing Durable Objects Directly
268286
269287
Alternatively, you can construct instances of your Durable Object using

docs/src/content/testing/vitest.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ order: 1
44

55
# ⚡️ Vitest Environment
66

7-
Miniflare includes a custom [Vitest](https://vitest.dev/) environment that allows you to run your unit
8-
tests within the Miniflare sandbox. Note that Vitest 0.23.0 is required.
7+
Miniflare includes a custom [Vitest](https://vitest.dev/) environment that
8+
allows you to run your unit tests within the Miniflare sandbox. Note that Vitest
9+
0.23.0 is required.
910

1011
## Setup
1112

@@ -21,8 +22,8 @@ In the following examples, we'll assume your `package.json` contains
2122
[⚡️ Developing with esbuild](/developing/esbuild) for an example.
2223

2324
To enable the Miniflare environment, set the
24-
[`environment` option](https://vitest.dev/config/#environment)
25-
in your Vitest configuration:
25+
[`environment` option](https://vitest.dev/config/#environment) in your Vitest
26+
configuration:
2627

2728
```ts
2829
---
@@ -294,6 +295,27 @@ test("flushes alarms", async () => {
294295
});
295296
```
296297
298+
To list all active Durable Objects in a namespace, use the
299+
`getMiniflareDurableObjectIds()` global function:
300+
301+
```js
302+
import { expect, test } from "vitest";
303+
const describe = setupMiniflareIsolatedStorage();
304+
305+
test("gets objects", async () => {
306+
// Get Durable Object stub
307+
const env = getMiniflareBindings();
308+
const id = env.TEST_OBJECT.newUniqueId();
309+
const stub = env.TEST_OBJECT.get(id);
310+
await stub.fetch("http://localhost/");
311+
312+
// Get all active TEST_OBJECT Durable Object IDs
313+
const ids = await getMiniflareDurableObjectIds("TEST_OBJECT");
314+
expect(ids).toHaveLength(1);
315+
expect(ids[0].toString()).toBe(id.toString());
316+
});
317+
```
318+
297319
### Constructing Durable Objects Directly
298320
299321
Alternatively, you can construct instances of your Durable Object using

0 commit comments

Comments
 (0)