test: unref cancelled broadcast source timer

The source delay should not keep the process alive after cancellation.
Keep the blocked-source cancellation assertions and unref its timer.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/65980
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
Filip Skokan authored and Antoine du Hamel committed 2026-09-25 18:01:48 +02:00
1 parent b29154d471
commit bfdf20729d
1 file changed
+2 -2
@@ -122,8 +122,8 @@ async function testBroadcastFromCancelWhileBlocked() {
async function* slowSource() {
const enc = new TextEncoder();
yield [enc.encode('chunk1')];
// Simulate a long delay - the cancel should unblock this
await new Promise((resolve) => setTimeout(resolve, 10000));
// Simulate a long delay without keeping the cancelled source alive.
await new Promise((resolve) => setTimeout(resolve, 10000).unref());
yield [enc.encode('chunk2')];
sourceFinished = true;
}