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 717f9c5 commit d07dd31Copy full SHA for d07dd31
test/parallel/test-stream-readable-async-iterators.js
@@ -527,5 +527,24 @@ async function tests() {
527
p.then(common.mustCall()).catch(common.mustNotCall());
528
}
529
530
+{
531
+ // AsyncIterator should finish correctly if destroyed.
532
+
533
+ const r = new Readable({
534
+ objectMode: true,
535
+ read() {
536
+ }
537
+ });
538
539
+ r.destroy();
540
+ r.on('close', () => {
541
+ const it = r[Symbol.asyncIterator]();
542
+ const next = it.next();
543
+ next
544
+ .then(common.mustCall(({ done }) => assert.strictEqual(done, true)))
545
+ .catch(common.mustNotCall());
546
547
+}
548
549
// To avoid missing some tests if a promise does not resolve
550
tests().then(common.mustCall());
0 commit comments