Skip to content

Commit f0ca58e

Browse files
committed
fix: code
1 parent 779bb7a commit f0ca58e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/internal/streams/duplexify.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ module.exports = function duplexify(body, name) {
8484

8585
if (typeof body === 'function') {
8686
const { value, write, final, destroy } = fromAsyncGen(body);
87+
88+
// body might be a constructor function instead of an async generator function.
8789
if (isDuplexNodeStream(value)) {
8890
return value;
8991
}

test/parallel/test-runner-run.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
9696
assert.match(stringResults[1], /tests 1/);
9797
assert.match(stringResults[1], /pass 1/);
9898
});
99+
100+
it('spec', async () => {
101+
const result = await run({
102+
files: [join(testFixtures, 'default-behavior/test/random.cjs')]
103+
}).compose(spec).toArray();
104+
const stringResults = result.map((bfr) => bfr.toString());
105+
assert.match(stringResults[0], /this should pass/);
106+
assert.match(stringResults[1], /tests 1/);
107+
assert.match(stringResults[1], /pass 1/);
108+
})
99109
});
100110

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

0 commit comments

Comments
 (0)