We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e82451 commit fbf1fb3Copy full SHA for fbf1fb3
test/parallel/test-webstream-structured-clone-no-leftovers.mjs
@@ -0,0 +1,28 @@
1
+import '../common/index.mjs';
2
+import { test } from 'node:test';
3
+import assert from 'node:assert';
4
+
5
+test('do not leak promises', async () => {
6
+ const buf = new Uint8Array(1);
7
+ const readable = new ReadableStream({
8
+ start(controller) {
9
+ controller.enqueue(buf);
10
+ controller.close();
11
+ }
12
+ });
13
14
+ const [out1, out2] = readable.tee();
15
+ const cloned = structuredClone(out2, { transfer: [out2] });
16
17
+ for await (const chunk of cloned) {
18
+ assert.deepStrictEqual(chunk, buf);
19
20
21
+ for await (const chunk of out2) {
22
23
24
25
+ for await (const chunk of out1) {
26
27
28
+});
0 commit comments