GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: add regression test for async iteration completion · nodejs/node@d07dd31

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-stream-readable-async-iterators.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-stream-readable-async-iterators.js
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,5 +527,24 @@ async function tests() {
527527
p.then(common.mustCall()).catch(common.mustNotCall());
528528
}
529529

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+
530549
// To avoid missing some tests if a promise does not resolve
531550
tests().then(common.mustCall());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.