Skip to content

Commit

Permalink
fix: code
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Oct 14, 2023
1 parent 779bb7a commit f0ca58e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/internal/streams/duplexify.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ module.exports = function duplexify(body, name) {

if (typeof body === 'function') {
const { value, write, final, destroy } = fromAsyncGen(body);

// body might be a constructor function instead of an async generator function.
if (isDuplexNodeStream(value)) {
return value;
}
Expand Down
10 changes: 10 additions & 0 deletions test/parallel/test-runner-run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
assert.match(stringResults[1], /tests 1/);
assert.match(stringResults[1], /pass 1/);
});

it('spec', async () => {
const result = await run({
files: [join(testFixtures, 'default-behavior/test/random.cjs')]
}).compose(spec).toArray();
const stringResults = result.map((bfr) => bfr.toString());
assert.match(stringResults[0], /this should pass/);
assert.match(stringResults[1], /tests 1/);
assert.match(stringResults[1], /pass 1/);
})
});

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

0 comments on commit f0ca58e

Please sign in to comment.