Skip to content

Commit

Permalink
test: check the pipeline AbortSignal reason is propagated
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinroger committed Oct 20, 2024
1 parent 48a15eb commit ed0d894
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1344,12 +1344,13 @@ tmpdir.refresh();

{
const ac = new AbortController();
const reason = new Error('Reason');
const r = Readable.from(async function* () {
for (let i = 0; i < 10; i++) {
await Promise.resolve();
yield String(i);
if (i === 5) {
ac.abort();
ac.abort(reason);
}
}
}());
Expand All @@ -1362,6 +1363,7 @@ tmpdir.refresh();
});
const cb = common.mustCall((err) => {
assert.strictEqual(err.name, 'AbortError');
assert.strictEqual(err.cause, reason);
assert.strictEqual(res, '012345');
assert.strictEqual(w.destroyed, true);
assert.strictEqual(r.destroyed, true);
Expand Down

0 comments on commit ed0d894

Please sign in to comment.