0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-webstreams-clone-unref.js
tsctx 66556f53a7
stream: fix cloned webstreams not being unref correctly
PR-URL: https://github.com/nodejs/node/pull/51526
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2024-01-23 06:31:45 +00:00

17 lines
471 B
JavaScript

'use strict';
require('../common');
const { ok } = require('node:assert');
// This test verifies that cloned ReadableStream and WritableStream instances
// do not keep the process alive. The test fails if it timesout (it should just
// exit immediately)
const rs1 = new ReadableStream();
const ws1 = new WritableStream();
const [rs2, ws2] = structuredClone([rs1, ws1], { transfer: [rs1, ws1] });
ok(rs2 instanceof ReadableStream);
ok(ws2 instanceof WritableStream);