Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: check the pipeline AbortSignal reason is propagated
  • Loading branch information
marvinroger committed Oct 20, 2024
commit ed0d894c3a634696f5f8bcaa0f6dfe74177c65e7
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