mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: add coverage for pipeline
co-authored-by: jazelly <xzha4350@gmail.com> PR-URL: https://github.com/nodejs/node/pull/56278 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
6156f8a6d5
commit
5ea6fa711e
1 file changed
+27
@@ -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'));
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user