mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
fbf1fb3bed
Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/51491 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
29 lines
659 B
JavaScript
29 lines
659 B
JavaScript
import '../common/index.mjs';
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert';
|
|
|
|
test('do not leak promises', async () => {
|
|
const buf = new Uint8Array(1);
|
|
const readable = new ReadableStream({
|
|
start(controller) {
|
|
controller.enqueue(buf);
|
|
controller.close();
|
|
}
|
|
});
|
|
|
|
const [out1, out2] = readable.tee();
|
|
const cloned = structuredClone(out2, { transfer: [out2] });
|
|
|
|
for await (const chunk of cloned) {
|
|
assert.deepStrictEqual(chunk, buf);
|
|
}
|
|
|
|
for await (const chunk of out2) {
|
|
assert.deepStrictEqual(chunk, buf);
|
|
}
|
|
|
|
for await (const chunk of out1) {
|
|
assert.deepStrictEqual(chunk, buf);
|
|
}
|
|
});
|