Skip to content

Commit 8feb3f6

Browse files
committed
test: check the pipeline AbortSignal reason is propagated
1 parent b309f21 commit 8feb3f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/parallel/test-stream-pipeline.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,12 +1344,13 @@ tmpdir.refresh();
13441344

13451345
{
13461346
const ac = new AbortController();
1347+
const reason = new Error('Reason');
13471348
const r = Readable.from(async function* () {
13481349
for (let i = 0; i < 10; i++) {
13491350
await Promise.resolve();
13501351
yield String(i);
13511352
if (i === 5) {
1352-
ac.abort();
1353+
ac.abort(reason);
13531354
}
13541355
}
13551356
}());
@@ -1362,6 +1363,7 @@ tmpdir.refresh();
13621363
});
13631364
const cb = common.mustCall((err) => {
13641365
assert.strictEqual(err.name, 'AbortError');
1366+
assert.strictEqual(err.cause, reason);
13651367
assert.strictEqual(res, '012345');
13661368
assert.strictEqual(w.destroyed, true);
13671369
assert.strictEqual(r.destroyed, true);

0 commit comments

Comments
 (0)