Skip to content

Commit 87c5750

Browse files
committed
test: async iterate destroyed stream
1 parent 1592d0a commit 87c5750

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/parallel/test-stream-readable-async-iterators.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,22 @@ async function tests() {
270270
assert.strictEqual(received, 1);
271271
}
272272

273+
{
274+
console.log('destroyed will not deadlock');
275+
const readable = new Readable();
276+
readable.destroy();
277+
process.nextTick(async () => {
278+
readable.on('close', common.mustNotCall());
279+
let received = 0;
280+
for await (const k of readable) {
281+
// Just make linting pass. This should never run.
282+
assert.strictEqual(k, 'hello');
283+
received++;
284+
}
285+
assert.strictEqual(received, 0);
286+
});
287+
}
288+
273289
{
274290
console.log('push async');
275291
const max = 42;

0 commit comments

Comments
 (0)