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: allow pass stream class to `stream.compose` · nodejs/node@ffdc357

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams
    • duplexify.js
  • test/parallel
    • test-runner-run.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/duplexify.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/duplexify.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ module.exports = function duplexify(body, name) {
8585
if (typeof body === 'function') {
8686
const { value, write, final, destroy } = fromAsyncGen(body);
8787

88+
// Body might be a constructor function instead of an async generator function.
89+
if (isDuplexNodeStream(value)) {
90+
return value;
91+
}
92+
8893
if (isIterable(value)) {
8994
return from(Duplexify, value, {
9095
// TODO (ronag): highWaterMark?
Collapse file

‎test/parallel/test-runner-run.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-run.mjs
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
104104
assert.match(stringResults[1], /tests 1/);
105105
assert.match(stringResults[1], /pass 1/);
106106
});
107+
108+
it('spec', async () => {
109+
const result = await run({
110+
files: [join(testFixtures, 'default-behavior/test/random.cjs')]
111+
}).compose(spec).toArray();
112+
const stringResults = result.map((bfr) => bfr.toString());
113+
assert.match(stringResults[0], /this should pass/);
114+
assert.match(stringResults[1], /tests 1/);
115+
assert.match(stringResults[1], /pass 1/);
116+
});
107117
});
108118

109119
it('should be piped with tap', async () => {

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.