Skip to content

Commit

Permalink
test: add coverage for pipeline
Browse files Browse the repository at this point in the history
co-authored-by: jazelly <[email protected]>
  • Loading branch information
jakecastelli and jazelly committed Dec 17, 2024
1 parent e009e53 commit 175b3aa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1723,3 +1723,30 @@ tmpdir.refresh();
});
src.destroy(new Error('problem'));
}

{
async function* myAsyncGenerator(ag) {
for await (const data of ag) {
yield data;
}
}

const duplexStream = Duplex.from(myAsyncGenerator);

const r = new Readable({
read() {
this.push('data1\n');
throw new Error('booom');
},
});

const w = new Writable({
write(chunk, encoding, callback) {
callback();
},
});

pipeline(r, duplexStream, w, common.mustCall((err) => {
assert.deepStrictEqual(err, new Error('booom'));
}));
}

0 comments on commit 175b3aa

Please sign in to comment.