Skip to content

Commit

Permalink
Improve test utility
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 10, 2024
1 parent 7ccab70 commit aa78dbf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import {Duplex} from 'node:stream';
import {Duplex, Readable} from 'node:stream';

export const createStream = streamDef => {
const generator = typeof streamDef === 'function' ? streamDef : function * () {
yield * streamDef;
};

return Duplex.from(generator);
};
export const createStream = streamDef => typeof streamDef === 'function'
? Duplex.from(streamDef)
: Readable.from(streamDef);

// Tests related to big buffers/strings can be slow. We run them serially and
// with a higher timeout to ensure they do not randomly fail.
Expand Down

0 comments on commit aa78dbf

Please sign in to comment.