Skip to content

Commit c062ffc

Browse files
jakecastellijazelly
authored andcommitted
test: add coverage for pipeline
co-authored-by: jazelly <xzha4350@gmail.com> PR-URL: #56278 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent d4404f0 commit c062ffc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/parallel/test-stream-pipeline.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,3 +1723,30 @@ tmpdir.refresh();
17231723
});
17241724
src.destroy(new Error('problem'));
17251725
}
1726+
1727+
{
1728+
async function* myAsyncGenerator(ag) {
1729+
for await (const data of ag) {
1730+
yield data;
1731+
}
1732+
}
1733+
1734+
const duplexStream = Duplex.from(myAsyncGenerator);
1735+
1736+
const r = new Readable({
1737+
read() {
1738+
this.push('data1\n');
1739+
throw new Error('booom');
1740+
},
1741+
});
1742+
1743+
const w = new Writable({
1744+
write(chunk, encoding, callback) {
1745+
callback();
1746+
},
1747+
});
1748+
1749+
pipeline(r, duplexStream, w, common.mustCall((err) => {
1750+
assert.deepStrictEqual(err, new Error('booom'));
1751+
}));
1752+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy