We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 538582b commit 80e75abCopy full SHA for 80e75ab
test/parallel/test-stream-readable-async-iterators.js
@@ -610,5 +610,24 @@ async function tests() {
610
p.then(common.mustCall()).catch(common.mustNotCall());
611
}
612
613
+{
614
+ // AsyncIterator should finish correctly if destroyed.
615
+
616
+ const r = new Readable({
617
+ objectMode: true,
618
+ read() {
619
+ }
620
+ });
621
622
+ r.destroy();
623
+ r.on('close', () => {
624
+ const it = r[Symbol.asyncIterator]();
625
+ const next = it.next();
626
+ next
627
+ .then(common.mustCall(({ done }) => assert.strictEqual(done, true)))
628
+ .catch(common.mustNotCall());
629
630
+}
631
632
// To avoid missing some tests if a promise does not resolve
633
tests().then(common.mustCall());
0 commit comments