Commit e666e11

Anton Golub <antongolub@antongolub.com>
2024-11-15 12:57:03
test: mixed stdio opts handling (#946)
relates #945
1 parent 63403c3
Changed files (1)
test/core.test.js
@@ -279,6 +279,27 @@ describe('core', () => {
         assert.equal(r1, r2)
       })
 
+      test('mixed', async () => {
+        assert.equal(
+          (
+            await $({
+              quiet: true,
+              stdio: ['inherit', 'pipe', 'ignore'],
+            })`>&2 echo error; echo ok`
+          ).toString(),
+          'ok\n'
+        )
+        assert.equal(
+          (
+            await $({ halt: true })`>&2 echo error; echo ok`
+              .stdio('inherit', 'ignore', 'pipe')
+              .quiet()
+              .run()
+          ).toString(),
+          'error\n'
+        )
+      })
+
       test('file stream as stdout', async () => {
         const createWriteStream = (f) => {
           const stream = fs.createWriteStream(f)