Skip to content

Commit 15bb135

Browse files
authoredNov 22, 2024
test: check values on pipe reject propagations (google#950)
1 parent e666e11 commit 15bb135

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎test/core.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,14 @@ describe('core', () => {
483483
await p1
484484
} catch (e) {
485485
assert.equal(e.exitCode, 1)
486+
assert.equal(e.stdout, '')
486487
}
487488

488489
try {
489490
await p2
490491
} catch (e) {
491492
assert.equal(e.exitCode, 1)
493+
assert.equal(e.stdout, '')
492494
}
493495

494496
const p3 = await $({ nothrow: true })`echo hello && exit 1`.pipe($`cat`)
@@ -500,14 +502,17 @@ describe('core', () => {
500502
await p4
501503
} catch (e) {
502504
assert.equal(e.exitCode, 1)
505+
assert.equal(e.stdout, '')
503506
}
504507

505508
const p5 = $`echo foo && exit 1`
506509
const [r1, r2] = await Promise.allSettled([
507510
p5.pipe($({ nothrow: true })`cat`),
508511
p5.pipe($`cat`),
509512
])
513+
assert.equal(r1.value.stdout, 'foo\n')
510514
assert.equal(r1.value.exitCode, 0)
515+
assert.equal(r2.reason.stdout, 'foo\n')
511516
assert.equal(r2.reason.exitCode, 1)
512517
})
513518
})

0 commit comments

Comments
 (0)