Skip to content

Commit 1b8bba8

Browse files
mcollinaRafaelGSS
authored andcommitted
test: add regression test for 51586
Signed-off-by: Matteo Collina <[email protected]> PR-URL: #51491 Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent 662ac95 commit 1b8bba8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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+
assert.deepStrictEqual(chunk, buf);
23+
}
24+
25+
for await (const chunk of out1) {
26+
assert.deepStrictEqual(chunk, buf);
27+
}
28+
});

0 commit comments

Comments
 (0)