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:
jakecastelliandjazelly authored and Node.js GitHub Bot committed 2024-12-24 13:30:55 +00:00
1 parent 6156f8a6d5
commit 5ea6fa711e
1 file changed
+27
+27
View File
@@ -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'));
}));
}