fd-options.js
This file
Path
test/arguments/fd-options.js
717 lines · 25.8 KiB · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
1import assert from 'node:assert/strict';2import {PassThrough} from 'node:stream';3import {spawn} from 'node:child_process';4import process from 'node:process';5import test from 'node:test';6import {assertThrows} from '../helpers/assert.js';7import {execa} from '../../index.js';8import {setFixtureDirectory} from '../helpers/fixtures-directory.js';9import {fullStdio, getStdio} from '../helpers/stdio.js';10import {getEarlyErrorSubprocess} from '../helpers/early-error.js';11import {assertPipeError} from '../helpers/pipe.js';1213setFixtureDirectory();1415const getMessage = message => Array.isArray(message)16 ? `"${message[0]}: ${message[1]}" option is incompatible`17 : message;1819const testPipeError = async ({20 message,21 sourceOptions = {},22 destinationOptions = {},23 getSource = () => execa('empty.js', sourceOptions),24 getDestination = () => execa('empty.js', destinationOptions),25 isScript = false,26 from,27 to,28}) => {29 const source = getSource();30 const pipePromise = isScript ? source.pipe({from, to})`empty.js` : source.pipe(getDestination(), {from, to});31 await assertPipeError(pipePromise, getMessage(message));32};3334const testNodeStream = async ({35 message,36 sourceOptions = {},37 getSource = () => execa('empty.js', sourceOptions),38 from,39 to,40 writable = to !== undefined,41}) => {42 assertNodeStream({43 message,44 getSource,45 from,46 to,47 methodName: writable ? 'writable' : 'readable',48 });49 assertNodeStream({50 message,51 getSource,52 from,53 to,54 methodName: 'duplex',55 });56};5758const assertNodeStream = ({message, getSource, from, to, methodName}) => {59 const error = assertThrows(() => {60 getSource()[methodName]({from, to});61 });62 assert.ok(error.message.includes(getMessage(message)));63};6465const testIterable = async ({66 message,67 sourceOptions = {},68 getSource = () => execa('empty.js', sourceOptions),69 from,70}) => {71 const error = assertThrows(() => {72 getSource().iterable({from});73 });74 assert.ok(error.message.includes(getMessage(message)));75};7677test('Must set "all" option to "true" to use .pipe("all")', () => testPipeError({78 from: 'all',79 message: '"all" option must be true',80}));81test('Must set "all" option to "true" to use .duplex("all")', () => testNodeStream({82 from: 'all',83 message: '"all" option must be true',84}));85test('Must set "all" option to "true" to use .iterable("all")', () => testIterable({86 from: 'all',87 message: '"all" option must be true',88}));89test('.pipe() cannot pipe to non-subprocesses', () => testPipeError({90 getDestination: () => new PassThrough(),91 message: 'an Execa subprocess',92}));93test('.pipe() cannot pipe to non-Execa subprocesses', () => testPipeError({94 getDestination: () => spawn('node', ['--version']),95 message: 'an Execa subprocess',96}));97test('.pipe() "from" option cannot be "stdin"', () => testPipeError({98 from: 'stdin',99 message: '"from" must not be',100}));101test('.duplex() "from" option cannot be "stdin"', () => testNodeStream({102 from: 'stdin',103 message: '"from" must not be',104}));105test('.iterable() "from" option cannot be "stdin"', () => testIterable({106 from: 'stdin',107 message: '"from" must not be',108}));109test('$.pipe() "from" option cannot be "stdin"', () => testPipeError({110 from: 'stdin',111 isScript: true,112 message: '"from" must not be',113}));114test('.pipe() "to" option cannot be "stdout"', () => testPipeError({115 to: 'stdout',116 message: '"to" must not be',117}));118test('.duplex() "to" option cannot be "stdout"', () => testNodeStream({119 to: 'stdout',120 message: '"to" must not be',121}));122test('$.pipe() "to" option cannot be "stdout"', () => testPipeError({123 to: 'stdout',124 isScript: true,125 message: '"to" must not be',126}));127test('.pipe() "from" option cannot be any string', () => testPipeError({128 from: 'other',129 message: 'must be "stdout", "stderr", "all"',130}));131test('.duplex() "from" option cannot be any string', () => testNodeStream({132 from: 'other',133 message: 'must be "stdout", "stderr", "all"',134}));135test('.iterable() "from" option cannot be any string', () => testIterable({136 from: 'other',137 message: 'must be "stdout", "stderr", "all"',138}));139test('.pipe() "to" option cannot be any string', () => testPipeError({140 to: 'other',141 message: 'must be "stdin"',142}));143test('.duplex() "to" option cannot be any string', () => testNodeStream({144 to: 'other',145 message: 'must be "stdin"',146}));147test('.pipe() "from" option cannot be a number without "fd"', () => testPipeError({148 from: '1',149 message: 'must be "stdout", "stderr", "all"',150}));151test('.duplex() "from" option cannot be a number without "fd"', () => testNodeStream({152 from: '1',153 message: 'must be "stdout", "stderr", "all"',154}));155test('.iterable() "from" option cannot be a number without "fd"', () => testIterable({156 from: '1',157 message: 'must be "stdout", "stderr", "all"',158}));159test('.pipe() "to" option cannot be a number without "fd"', () => testPipeError({160 to: '0',161 message: 'must be "stdin"',162}));163test('.duplex() "to" option cannot be a number without "fd"', () => testNodeStream({164 to: '0',165 message: 'must be "stdin"',166}));167test('.pipe() "from" option cannot be just "fd"', () => testPipeError({168 from: 'fd',169 message: 'must be "stdout", "stderr", "all"',170}));171test('.duplex() "from" option cannot be just "fd"', () => testNodeStream({172 from: 'fd',173 message: 'must be "stdout", "stderr", "all"',174}));175test('.iterable() "from" option cannot be just "fd"', () => testIterable({176 from: 'fd',177 message: 'must be "stdout", "stderr", "all"',178}));179test('.pipe() "to" option cannot be just "fd"', () => testPipeError({180 to: 'fd',181 message: 'must be "stdin"',182}));183test('.duplex() "to" option cannot be just "fd"', () => testNodeStream({184 to: 'fd',185 message: 'must be "stdin"',186}));187test('.pipe() "from" option cannot be a float', () => testPipeError({188 from: 'fd1.5',189 message: 'must be "stdout", "stderr", "all"',190}));191test('.duplex() "from" option cannot be a float', () => testNodeStream({192 from: 'fd1.5',193 message: 'must be "stdout", "stderr", "all"',194}));195test('.iterable() "from" option cannot be a float', () => testIterable({196 from: 'fd1.5',197 message: 'must be "stdout", "stderr", "all"',198}));199test('.pipe() "to" option cannot be a float', () => testPipeError({200 to: 'fd1.5',201 message: 'must be "stdin"',202}));203test('.duplex() "to" option cannot be a float', () => testNodeStream({204 to: 'fd1.5',205 message: 'must be "stdin"',206}));207test('.pipe() "from" option cannot be a negative number', () => testPipeError({208 from: 'fd-1',209 message: 'must be "stdout", "stderr", "all"',210}));211test('.duplex() "from" option cannot be a negative number', () => testNodeStream({212 from: 'fd-1',213 message: 'must be "stdout", "stderr", "all"',214}));215test('.iterable() "from" option cannot be a negative number', () => testIterable({216 from: 'fd-1',217 message: 'must be "stdout", "stderr", "all"',218}));219test('.pipe() "to" option cannot be a negative number', () => testPipeError({220 to: 'fd-1',221 message: 'must be "stdin"',222}));223test('.duplex() "to" option cannot be a negative number', () => testNodeStream({224 to: 'fd-1',225 message: 'must be "stdin"',226}));227test('.pipe() "from" option cannot be a non-existing file descriptor', () => testPipeError({228 from: 'fd3',229 message: 'file descriptor does not exist',230}));231test('.duplex() "from" cannot be a non-existing file descriptor', () => testNodeStream({232 from: 'fd3',233 message: 'file descriptor does not exist',234}));235test('.iterable() "from" cannot be a non-existing file descriptor', () => testIterable({236 from: 'fd3',237 message: 'file descriptor does not exist',238}));239test('.pipe() "to" option cannot be a non-existing file descriptor', () => testPipeError({240 to: 'fd3',241 message: 'file descriptor does not exist',242}));243test('.duplex() "to" cannot be a non-existing file descriptor', () => testNodeStream({244 to: 'fd3',245 message: 'file descriptor does not exist',246}));247test('.pipe() "from" option cannot be an input file descriptor', () => testPipeError({248 sourceOptions: getStdio(3, new Uint8Array()),249 from: 'fd3',250 message: 'must be a readable stream',251}));252test('.duplex() "from" option cannot be an input file descriptor', () => testNodeStream({253 sourceOptions: getStdio(3, new Uint8Array()),254 from: 'fd3',255 message: 'must be a readable stream',256}));257test('.iterable() "from" option cannot be an input file descriptor', () => testIterable({258 sourceOptions: getStdio(3, new Uint8Array()),259 from: 'fd3',260 message: 'must be a readable stream',261}));262test('.pipe() "to" option cannot be an output file descriptor', () => testPipeError({263 destinationOptions: fullStdio,264 to: 'fd3',265 message: 'must be a writable stream',266}));267test('.duplex() "to" option cannot be an output file descriptor', () => testNodeStream({268 sourceOptions: fullStdio,269 to: 'fd3',270 message: 'must be a writable stream',271}));272test('.duplex() "to" option on an output file descriptor suggests the input-pipe syntax', () => testNodeStream({273 sourceOptions: fullStdio,274 to: 'fd3',275 message: '{value: \'pipe\', input: true}',276}));277test('.pipe() "to" option cannot be "all"', () => testPipeError({278 destinationOptions: fullStdio,279 to: 'all',280 message: 'must be a writable stream',281}));282test('.duplex() "to" option cannot be "all"', () => testNodeStream({283 sourceOptions: fullStdio,284 to: 'all',285 message: 'must be a writable stream',286}));287test('Cannot set "stdout" option to "ignore" to use .pipe()', () => testPipeError({288 sourceOptions: {stdout: 'ignore'},289 message: ['stdout', '\'ignore\''],290}));291test('Cannot set "stdout" option to "ignore" to use .duplex()', () => testNodeStream({292 sourceOptions: {stdout: 'ignore'},293 message: ['stdout', '\'ignore\''],294}));295test('Cannot set "stdout" option to "ignore" to use .iterable()', () => testIterable({296 sourceOptions: {stdout: 'ignore'},297 message: ['stdout', '\'ignore\''],298}));299test('Cannot set "stdin" option to "ignore" to use .pipe()', () => testPipeError({300 destinationOptions: {stdin: 'ignore'},301 message: ['stdin', '\'ignore\''],302}));303test('Cannot set "stdin" option to "ignore" to use .duplex()', () => testNodeStream({304 sourceOptions: {stdin: 'ignore'},305 message: ['stdin', '\'ignore\''],306 writable: true,307}));308test('Cannot set "stdout" option to "ignore" to use .pipe(1)', () => testPipeError({309 sourceOptions: {stdout: 'ignore'},310 from: 'fd1',311 message: ['stdout', '\'ignore\''],312}));313test('Cannot set "stdout" option to "ignore" to use .duplex(1)', () => testNodeStream({314 sourceOptions: {stdout: 'ignore'},315 from: 'fd1',316 message: ['stdout', '\'ignore\''],317}));318test('Cannot set "stdout" option to "ignore" to use .iterable(1)', () => testIterable({319 sourceOptions: {stdout: 'ignore'},320 from: 'fd1',321 message: ['stdout', '\'ignore\''],322}));323test('Cannot set "stdin" option to "ignore" to use .pipe(0)', () => testPipeError({324 destinationOptions: {stdin: 'ignore'},325 message: ['stdin', '\'ignore\''],326 to: 'fd0',327}));328test('Cannot set "stdin" option to "ignore" to use .duplex(0)', () => testNodeStream({329 sourceOptions: {stdin: 'ignore'},330 message: ['stdin', '\'ignore\''],331 to: 'fd0',332}));333test('Cannot set "stdout" option to "ignore" to use .pipe("stdout")', () => testPipeError({334 sourceOptions: {stdout: 'ignore'},335 from: 'stdout',336 message: ['stdout', '\'ignore\''],337}));338test('Cannot set "stdout" option to "ignore" to use .duplex("stdout")', () => testNodeStream({339 sourceOptions: {stdout: 'ignore'},340 from: 'stdout',341 message: ['stdout', '\'ignore\''],342}));343test('Cannot set "stdout" option to "ignore" to use .iterable("stdout")', () => testIterable({344 sourceOptions: {stdout: 'ignore'},345 from: 'stdout',346 message: ['stdout', '\'ignore\''],347}));348test('Cannot set "stdin" option to "ignore" to use .pipe("stdin")', () => testPipeError({349 destinationOptions: {stdin: 'ignore'},350 message: ['stdin', '\'ignore\''],351 to: 'stdin',352}));353test('Cannot set "stdin" option to "ignore" to use .duplex("stdin")', () => testNodeStream({354 sourceOptions: {stdin: 'ignore'},355 message: ['stdin', '\'ignore\''],356 to: 'stdin',357}));358test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe()', () => testPipeError({359 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},360 message: ['stdout', '\'ignore\''],361}));362test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex()', () => testNodeStream({363 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},364 message: ['stdout', '\'ignore\''],365}));366test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable()', () => testIterable({367 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},368 message: ['stdout', '\'ignore\''],369}));370test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe(1)', () => testPipeError({371 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},372 from: 'fd1',373 message: ['stdout', '\'ignore\''],374}));375test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex(1)', () => testNodeStream({376 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},377 from: 'fd1',378 message: ['stdout', '\'ignore\''],379}));380test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable(1)', () => testIterable({381 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},382 from: 'fd1',383 message: ['stdout', '\'ignore\''],384}));385test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe("stdout")', () => testPipeError({386 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},387 from: 'stdout',388 message: ['stdout', '\'ignore\''],389}));390test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex("stdout")', () => testNodeStream({391 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},392 from: 'stdout',393 message: ['stdout', '\'ignore\''],394}));395test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable("stdout")', () => testIterable({396 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},397 from: 'stdout',398 message: ['stdout', '\'ignore\''],399}));400test('Cannot set "stdio[1]" option to "ignore" to use .pipe()', () => testPipeError({401 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},402 message: ['stdio[1]', '\'ignore\''],403}));404test('Cannot set "stdio[1]" option to "ignore" to use .duplex()', () => testNodeStream({405 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},406 message: ['stdio[1]', '\'ignore\''],407}));408test('Cannot set "stdio[1]" option to "ignore" to use .iterable()', () => testIterable({409 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},410 message: ['stdio[1]', '\'ignore\''],411}));412test('Cannot set "stdio[0]" option to "ignore" to use .pipe()', () => testPipeError({413 destinationOptions: {stdio: ['ignore', 'pipe', 'pipe']},414 message: ['stdio[0]', '\'ignore\''],415}));416test('Cannot set "stdio[0]" option to "ignore" to use .duplex()', () => testNodeStream({417 sourceOptions: {stdio: ['ignore', 'pipe', 'pipe']},418 message: ['stdio[0]', '\'ignore\''],419 writable: true,420}));421test('Cannot set "stdio[1]" option to "ignore" to use .pipe(1)', () => testPipeError({422 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},423 from: 'fd1',424 message: ['stdio[1]', '\'ignore\''],425}));426test('Cannot set "stdio[1]" option to "ignore" to use .duplex(1)', () => testNodeStream({427 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},428 from: 'fd1',429 message: ['stdio[1]', '\'ignore\''],430}));431test('Cannot set "stdio[1]" option to "ignore" to use .iterable(1)', () => testIterable({432 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},433 from: 'fd1',434 message: ['stdio[1]', '\'ignore\''],435}));436test('Cannot set "stdio[0]" option to "ignore" to use .pipe(0)', () => testPipeError({437 destinationOptions: {stdio: ['ignore', 'pipe', 'pipe']},438 message: ['stdio[0]', '\'ignore\''],439 to: 'fd0',440}));441test('Cannot set "stdio[0]" option to "ignore" to use .duplex(0)', () => testNodeStream({442 sourceOptions: {stdio: ['ignore', 'pipe', 'pipe']},443 message: ['stdio[0]', '\'ignore\''],444 to: 'fd0',445}));446test('Cannot set "stdio[1]" option to "ignore" to use .pipe("stdout")', () => testPipeError({447 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},448 from: 'stdout',449 message: ['stdio[1]', '\'ignore\''],450}));451test('Cannot set "stdio[1]" option to "ignore" to use .duplex("stdout")', () => testNodeStream({452 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},453 from: 'stdout',454 message: ['stdio[1]', '\'ignore\''],455}));456test('Cannot set "stdio[1]" option to "ignore" to use .iterable("stdout")', () => testIterable({457 sourceOptions: {stdio: ['pipe', 'ignore', 'pipe']},458 from: 'stdout',459 message: ['stdio[1]', '\'ignore\''],460}));461test('Cannot set "stdio[0]" option to "ignore" to use .pipe("stdin")', () => testPipeError({462 destinationOptions: {stdio: ['ignore', 'pipe', 'pipe']},463 message: ['stdio[0]', '\'ignore\''],464 to: 'stdin',465}));466test('Cannot set "stdio[0]" option to "ignore" to use .duplex("stdin")', () => testNodeStream({467 sourceOptions: {stdio: ['ignore', 'pipe', 'pipe']},468 message: ['stdio[0]', '\'ignore\''],469 to: 'stdin',470}));471test('Cannot set "stderr" option to "ignore" to use .pipe(2)', () => testPipeError({472 sourceOptions: {stderr: 'ignore'},473 from: 'fd2',474 message: ['stderr', '\'ignore\''],475}));476test('Cannot set "stderr" option to "ignore" to use .duplex(2)', () => testNodeStream({477 sourceOptions: {stderr: 'ignore'},478 from: 'fd2',479 message: ['stderr', '\'ignore\''],480}));481test('Cannot set "stderr" option to "ignore" to use .iterable(2)', () => testIterable({482 sourceOptions: {stderr: 'ignore'},483 from: 'fd2',484 message: ['stderr', '\'ignore\''],485}));486test('Cannot set "stderr" option to "ignore" to use .pipe("stderr")', () => testPipeError({487 sourceOptions: {stderr: 'ignore'},488 from: 'stderr',489 message: ['stderr', '\'ignore\''],490}));491test('Cannot set "stderr" option to "ignore" to use .duplex("stderr")', () => testNodeStream({492 sourceOptions: {stderr: 'ignore'},493 from: 'stderr',494 message: ['stderr', '\'ignore\''],495}));496test('Cannot set "stderr" option to "ignore" to use .iterable("stderr")', () => testIterable({497 sourceOptions: {stderr: 'ignore'},498 from: 'stderr',499 message: ['stderr', '\'ignore\''],500}));501test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe(2)', () => testPipeError({502 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},503 from: 'fd2',504 message: ['stderr', '\'ignore\''],505}));506test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex(2)', () => testNodeStream({507 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},508 from: 'fd2',509 message: ['stderr', '\'ignore\''],510}));511test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable(2)', () => testIterable({512 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},513 from: 'fd2',514 message: ['stderr', '\'ignore\''],515}));516test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe("stderr")', () => testPipeError({517 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},518 from: 'stderr',519 message: ['stderr', '\'ignore\''],520}));521test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex("stderr")', () => testNodeStream({522 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},523 from: 'stderr',524 message: ['stderr', '\'ignore\''],525}));526test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable("stderr")', () => testIterable({527 sourceOptions: {stdout: 'ignore', stderr: 'ignore'},528 from: 'stderr',529 message: ['stderr', '\'ignore\''],530}));531test('Cannot set "stdio[2]" option to "ignore" to use .pipe(2)', () => testPipeError({532 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},533 from: 'fd2',534 message: ['stdio[2]', '\'ignore\''],535}));536test('Cannot set "stdio[2]" option to "ignore" to use .duplex(2)', () => testNodeStream({537 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},538 from: 'fd2',539 message: ['stdio[2]', '\'ignore\''],540}));541test('Cannot set "stdio[2]" option to "ignore" to use .iterable(2)', () => testIterable({542 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},543 from: 'fd2',544 message: ['stdio[2]', '\'ignore\''],545}));546test('Cannot set "stdio[2]" option to "ignore" to use .pipe("stderr")', () => testPipeError({547 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},548 from: 'stderr',549 message: ['stdio[2]', '\'ignore\''],550}));551test('Cannot set "stdio[2]" option to "ignore" to use .duplex("stderr")', () => testNodeStream({552 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},553 from: 'stderr',554 message: ['stdio[2]', '\'ignore\''],555}));556test('Cannot set "stdio[2]" option to "ignore" to use .iterable("stderr")', () => testIterable({557 sourceOptions: {stdio: ['pipe', 'pipe', 'ignore']},558 from: 'stderr',559 message: ['stdio[2]', '\'ignore\''],560}));561test('Cannot set "stdio[3]" option to "ignore" to use .pipe(3)', () => testPipeError({562 sourceOptions: getStdio(3, 'ignore'),563 from: 'fd3',564 message: ['stdio[3]', '\'ignore\''],565}));566test('Cannot set "stdio[3]" option to "ignore" to use .duplex(3)', () => testNodeStream({567 sourceOptions: getStdio(3, 'ignore'),568 from: 'fd3',569 message: ['stdio[3]', '\'ignore\''],570}));571test('Cannot set "stdio[3]" option to "ignore" to use .iterable(3)', () => testIterable({572 sourceOptions: getStdio(3, 'ignore'),573 from: 'fd3',574 message: ['stdio[3]', '\'ignore\''],575}));576test('Cannot set "stdout" + "stderr" option to "ignore" to use .pipe("all")', () => testPipeError({577 sourceOptions: {stdout: 'ignore', stderr: 'ignore', all: true},578 from: 'all',579 message: ['stdout', '\'ignore\''],580}));581test('Cannot set "stdout" + "stderr" option to "ignore" to use .duplex("all")', () => testNodeStream({582 sourceOptions: {stdout: 'ignore', stderr: 'ignore', all: true},583 from: 'all',584 message: ['stdout', '\'ignore\''],585}));586test('Cannot set "stdout" + "stderr" option to "ignore" to use .iterable("all")', () => testIterable({587 sourceOptions: {stdout: 'ignore', stderr: 'ignore', all: true},588 from: 'all',589 message: ['stdout', '\'ignore\''],590}));591test('Cannot set "stdio[1]" + "stdio[2]" option to "ignore" to use .pipe("all")', () => testPipeError({592 sourceOptions: {stdio: ['pipe', 'ignore', 'ignore'], all: true},593 from: 'all',594 message: ['stdio[1]', '\'ignore\''],595}));596test('Cannot set "stdio[1]" + "stdio[2]" option to "ignore" to use .duplex("all")', () => testNodeStream({597 sourceOptions: {stdio: ['pipe', 'ignore', 'ignore'], all: true},598 from: 'all',599 message: ['stdio[1]', '\'ignore\''],600}));601test('Cannot set "stdio[1]" + "stdio[2]" option to "ignore" to use .iterable("all")', () => testIterable({602 sourceOptions: {stdio: ['pipe', 'ignore', 'ignore'], all: true},603 from: 'all',604 message: ['stdio[1]', '\'ignore\''],605}));606test('Cannot set "stdout" option to "inherit" to use .pipe()', () => testPipeError({607 sourceOptions: {stdout: 'inherit'},608 message: ['stdout', '\'inherit\''],609}));610test('Cannot set "stdout" option to "inherit" to use .duplex()', () => testNodeStream({611 sourceOptions: {stdout: 'inherit'},612 message: ['stdout', '\'inherit\''],613}));614test('Cannot set "stdout" option to "inherit" to use .iterable()', () => testIterable({615 sourceOptions: {stdout: 'inherit'},616 message: ['stdout', '\'inherit\''],617}));618test('Cannot set "stdin" option to "inherit" to use .pipe()', () => testPipeError({619 destinationOptions: {stdin: 'inherit'},620 message: ['stdin', '\'inherit\''],621}));622test('Cannot set "stdin" option to "inherit" to use .duplex()', () => testNodeStream({623 sourceOptions: {stdin: 'inherit'},624 message: ['stdin', '\'inherit\''],625 writable: true,626}));627test('Cannot set "stdout" option to file descriptors to use .pipe()', () => testPipeError({628 sourceOptions: {stdout: 1},629 message: ['stdout', '1'],630}));631test('Cannot set "stdout" option to file descriptors to use .duplex()', () => testNodeStream({632 sourceOptions: {stdout: 1},633 message: ['stdout', '1'],634}));635test('Cannot set "stdout" option to file descriptors to use .iterable()', () => testIterable({636 sourceOptions: {stdout: 1},637 message: ['stdout', '1'],638}));639test('Cannot set "stdin" option to file descriptors to use .pipe()', () => testPipeError({640 destinationOptions: {stdin: 0},641 message: ['stdin', '0'],642}));643test('Cannot set "stdin" option to file descriptors to use .duplex()', () => testNodeStream({644 sourceOptions: {stdin: 0},645 message: ['stdin', '0'],646 writable: true,647}));648test('Cannot set "stdout" option to Node.js streams to use .pipe()', () => testPipeError({649 sourceOptions: {stdout: process.stdout},650 message: ['stdout', 'Stream'],651}));652test('Cannot set "stdout" option to Node.js streams to use .duplex()', () => testNodeStream({653 sourceOptions: {stdout: process.stdout},654 message: ['stdout', 'Stream'],655}));656test('Cannot set "stdout" option to Node.js streams to use .iterable()', () => testIterable({657 sourceOptions: {stdout: process.stdout},658 message: ['stdout', 'Stream'],659}));660test('Cannot set "stdin" option to Node.js streams to use .pipe()', () => testPipeError({661 destinationOptions: {stdin: process.stdin},662 message: ['stdin', 'Stream'],663}));664test('Cannot set "stdin" option to Node.js streams to use .duplex()', () => testNodeStream({665 sourceOptions: {stdin: process.stdin},666 message: ['stdin', 'Stream'],667 writable: true,668}));669test('Cannot set "stdio[3]" option to Node.js Writable streams to use .pipe()', () => testPipeError({670 sourceOptions: getStdio(3, process.stdout),671 message: ['stdio[3]', 'Stream'],672 from: 'fd3',673}));674test('Cannot set "stdio[3]" option to Node.js Writable streams to use .duplex()', () => testNodeStream({675 sourceOptions: getStdio(3, process.stdout),676 message: ['stdio[3]', 'Stream'],677 from: 'fd3',678}));679test('Cannot set "stdio[3]" option to Node.js Writable streams to use .iterable()', () => testIterable({680 sourceOptions: getStdio(3, process.stdout),681 message: ['stdio[3]', 'Stream'],682 from: 'fd3',683}));684test('Cannot set "stdio[3]" option to Node.js Readable streams to use .pipe()', () => testPipeError({685 destinationOptions: getStdio(3, process.stdin),686 message: ['stdio[3]', 'Stream'],687 to: 'fd3',688}));689test('Cannot set "stdio[3]" option to Node.js Readable streams to use .duplex()', () => testNodeStream({690 sourceOptions: getStdio(3, process.stdin),691 message: ['stdio[3]', 'Stream'],692 to: 'fd3',693}));694695test('Sets the right error message when the "all" option is incompatible - execa.$', async () => {696 await assertPipeError(execa('empty.js')697 .pipe({all: false})`stdin.js`698 .pipe(execa('empty.js'), {from: 'all'}),699 '"all" option must be true',700 );701});702703test('Sets the right error message when the "all" option is incompatible - execa.execa', async () => {704 await assertPipeError(execa('empty.js')705 .pipe(execa('stdin.js', {all: false}))706 .pipe(execa('empty.js'), {from: 'all'}),707 '"all" option must be true',708 );709});710711test('Sets the right error message when the "all" option is incompatible - early error', async () => {712 await assertPipeError(getEarlyErrorSubprocess()713 .pipe(execa('stdin.js', {all: false}))714 .pipe(execa('empty.js'), {from: 'all'}),715 '"all" option must be true',716 );717});