result-stdio.test-d.ts
This file
Path
test-d/return/result-stdio.test-d.ts
187 lines · 9.6 KiB · TypeScript
Last changed by
Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
100% test coverage (#1018)ehmickybefore adoption9f65b86
line 1why, one step back1import {Readable, Writable} from 'node:stream';Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 2why, one step back2import {expectTypeOf} from 'nz';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 3–5why, one step back3import {4 execa,5 execaSync,Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb
line 6why, one step back6 execaNode,100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 7–11why, one step back7 type ExecaError,8 type ExecaSyncError,9} from '../../index.js';1011const unicornsResult = await execa('unicorns', {all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 12–18why, one step back12expectTypeOf(unicornsResult.stdio[0]).toBe<undefined>();13expectTypeOf(unicornsResult.stdout).toBe<string>();14expectTypeOf(unicornsResult.stdio[1]).toBe<string>();15expectTypeOf(unicornsResult.stderr).toBe<string>();16expectTypeOf(unicornsResult.stdio[2]).toBe<string>();17expectTypeOf(unicornsResult.all).toBe<string>();18expectTypeOf(unicornsResult.stdio[3 as number]).toBe<string | undefined>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 19–20why, one step back1920const bufferResult = await execa('unicorns', {encoding: 'buffer', all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 21–25why, one step back21expectTypeOf(bufferResult.stdout).toBe<Uint8Array>();22expectTypeOf(bufferResult.stdio[1]).toBe<Uint8Array>();23expectTypeOf(bufferResult.stderr).toBe<Uint8Array>();24expectTypeOf(bufferResult.stdio[2]).toBe<Uint8Array>();25expectTypeOf(bufferResult.all).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 26–27why, one step back2627const hexResult = await execa('unicorns', {encoding: 'hex', all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 28–32why, one step back28expectTypeOf(hexResult.stdout).toBe<string>();29expectTypeOf(hexResult.stdio[1]).toBe<string>();30expectTypeOf(hexResult.stderr).toBe<string>();31expectTypeOf(hexResult.stdio[2]).toBe<string>();32expectTypeOf(hexResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 33–34why, one step back3334const unicornsResultSync = execaSync('unicorns', {all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 35–40why, one step back35expectTypeOf(unicornsResultSync.stdio[0]).toBe<undefined>();36expectTypeOf(unicornsResultSync.stdout).toBe<string>();37expectTypeOf(unicornsResultSync.stdio[1]).toBe<string>();38expectTypeOf(unicornsResultSync.stderr).toBe<string>();39expectTypeOf(unicornsResultSync.stdio[2]).toBe<string>();40expectTypeOf(unicornsResultSync.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 41–42why, one step back4142const bufferResultSync = execaSync('unicorns', {encoding: 'buffer', all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 43–48why, one step back43expectTypeOf(bufferResultSync.stdio[0]).toBe<undefined>();44expectTypeOf(bufferResultSync.stdout).toBe<Uint8Array>();45expectTypeOf(bufferResultSync.stdio[1]).toBe<Uint8Array>();46expectTypeOf(bufferResultSync.stderr).toBe<Uint8Array>();47expectTypeOf(bufferResultSync.stdio[2]).toBe<Uint8Array>();48expectTypeOf(bufferResultSync.all).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 49–50why, one step back4950const execaStringError = new Error('.') as ExecaError<{all: true}>;Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 51–56why, one step back51expectTypeOf(execaStringError.stdio[0]).toBe<undefined>();52expectTypeOf(execaStringError.stdout).toBe<string>();53expectTypeOf(execaStringError.stdio[1]).toBe<string>();54expectTypeOf(execaStringError.stderr).toBe<string>();55expectTypeOf(execaStringError.stdio[2]).toBe<string>();56expectTypeOf(execaStringError.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 57–58why, one step back5758const execaBufferError = new Error('.') as ExecaError<{encoding: 'buffer'; all: true}>;Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 59–64why, one step back59expectTypeOf(execaBufferError.stdio[0]).toBe<undefined>();60expectTypeOf(execaBufferError.stdout).toBe<Uint8Array>();61expectTypeOf(execaBufferError.stdio[1]).toBe<Uint8Array>();62expectTypeOf(execaBufferError.stderr).toBe<Uint8Array>();63expectTypeOf(execaBufferError.stdio[2]).toBe<Uint8Array>();64expectTypeOf(execaBufferError.all).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 65–66why, one step back6566const execaStringErrorSync = new Error('.') as ExecaSyncError<{all: true}>;Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 67–72why, one step back67expectTypeOf(execaStringErrorSync.stdio[0]).toBe<undefined>();68expectTypeOf(execaStringErrorSync.stdout).toBe<string>();69expectTypeOf(execaStringErrorSync.stdio[1]).toBe<string>();70expectTypeOf(execaStringErrorSync.stderr).toBe<string>();71expectTypeOf(execaStringErrorSync.stdio[2]).toBe<string>();72expectTypeOf(execaStringErrorSync.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 73–74why, one step back7374const execaBufferErrorSync = new Error('.') as ExecaSyncError<{encoding: 'buffer'; all: true}>;Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 75–80why, one step back75expectTypeOf(execaBufferErrorSync.stdio[0]).toBe<undefined>();76expectTypeOf(execaBufferErrorSync.stdout).toBe<Uint8Array>();77expectTypeOf(execaBufferErrorSync.stdio[1]).toBe<Uint8Array>();78expectTypeOf(execaBufferErrorSync.stderr).toBe<Uint8Array>();79expectTypeOf(execaBufferErrorSync.stdio[2]).toBe<Uint8Array>();80expectTypeOf(execaBufferErrorSync.all).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 81–82why, one step back8182const multipleStdoutResult = await execa('unicorns', {stdout: ['inherit', 'pipe'] as ['inherit', 'pipe'], all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 83–87why, one step back83expectTypeOf(multipleStdoutResult.stdout).toBe<string>();84expectTypeOf(multipleStdoutResult.stdio[1]).toBe<string>();85expectTypeOf(multipleStdoutResult.stderr).toBe<string>();86expectTypeOf(multipleStdoutResult.stdio[2]).toBe<string>();87expectTypeOf(multipleStdoutResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 88–89why, one step back8889const undefinedStdoutResult = await execa('unicorns', {stdout: undefined, all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 90–92why, one step back90expectTypeOf(undefinedStdoutResult.stdout).toBe<string>();91expectTypeOf(undefinedStdoutResult.stderr).toBe<string>();92expectTypeOf(undefinedStdoutResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 93–94why, one step back9394const undefinedArrayStdoutResult = await execa('unicorns', {stdout: [undefined] as const, all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 95–97why, one step back95expectTypeOf(undefinedArrayStdoutResult.stdout).toBe<string>();96expectTypeOf(undefinedArrayStdoutResult.stderr).toBe<string>();97expectTypeOf(undefinedArrayStdoutResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 98–99why, one step back9899const undefinedStderrResult = await execa('unicorns', {stderr: undefined, all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 100–102why, one step back100expectTypeOf(undefinedStderrResult.stdout).toBe<string>();101expectTypeOf(undefinedStderrResult.stderr).toBe<string>();102expectTypeOf(undefinedStderrResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 103–104why, one step back103104const undefinedArrayStderrResult = await execa('unicorns', {stderr: [undefined] as const, all: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 105–107why, one step back105expectTypeOf(undefinedArrayStderrResult.stdout).toBe<string>();106expectTypeOf(undefinedArrayStderrResult.stderr).toBe<string>();107expectTypeOf(undefinedArrayStderrResult.all).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 108–109why, one step back108109const fd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe']});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 110why, one step back110expectTypeOf(fd3Result.stdio[3]).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 111–112why, one step back111112const inputFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', ['pipe', new Readable()]]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 113why, one step back113expectTypeOf(inputFd3Result.stdio[3]).toBe<undefined>();100% test coverage (#1018)ehmickybefore adoption9f65b86
line 114why, one step back114Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 115why, one step back115const inputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: true}]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 116why, one step back116expectTypeOf(inputPipeFd3Result.stdio[3]).toBe<undefined>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 117why, one step back117Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba
line 118why, one step back118const inputInheritFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'inherit', input: true}]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 119why, one step back119expectTypeOf(inputInheritFd3Result.stdio[3]).toBe<undefined>();Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba
lines 120–121why, one step back120121const inputFdFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 3, input: true}]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 122why, one step back122expectTypeOf(inputFdFd3Result.stdio[3]).toBe<undefined>();Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba
line 123why, one step back123Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 124why, one step back124const outputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe'}]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 125why, one step back125expectTypeOf(outputPipeFd3Result.stdio[3]).toBe<string>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 126why, one step back126Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
lines 127–128why, one step back127const isInput = true as boolean;128const booleanInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: isInput}]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 129why, one step back129expectTypeOf(booleanInputPipeFd3Result.stdio[3]).toBe<string | undefined>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 130why, one step back130Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 131why, one step back131const optionalInputPipe: {readonly value: 'pipe'; readonly input?: boolean} = {value: 'pipe', input: isInput};Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 132why, one step back132const optionalInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalInputPipe]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 133why, one step back133expectTypeOf(optionalInputPipeFd3Result.stdio[3]).toBe<string | undefined>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
lines 134–136why, one step back134135const optionalTrueInputPipe: {readonly value: 'pipe'; readonly input?: true} = {value: 'pipe', input: true};136const optionalTrueInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalTrueInputPipe]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 137why, one step back137expectTypeOf(optionalTrueInputPipeFd3Result.stdio[3]).toBe<string | undefined>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
lines 138–139why, one step back138139const stdoutInputPipeResult = await execa('unicorns', {stdout: {value: 'pipe', input: true}});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 140–141why, one step back140expectTypeOf(stdoutInputPipeResult.stdout).toBe<string>();141expectTypeOf(stdoutInputPipeResult.stdio[1]).toBe<string>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
lines 142–143why, one step back142143const stderrInputPipeResult = await execa('unicorns', {stderr: {value: 'pipe', input: true}});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
lines 144–145why, one step back144expectTypeOf(stderrInputPipeResult.stderr).toBe<string>();145expectTypeOf(stderrInputPipeResult.stdio[2]).toBe<string>();Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4
line 146why, one step back146100% test coverage (#1018)ehmickybefore adoption9f65b86
line 147why, one step back147const outputFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', ['pipe', new Writable()]]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 148why, one step back148expectTypeOf(outputFd3Result.stdio[3]).toBe<string>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 149–150why, one step back149150const bufferFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe'], encoding: 'buffer'});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 151why, one step back151expectTypeOf(bufferFd3Result.stdio[3]).toBe<Uint8Array>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 152–153why, one step back152153const undefinedFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', undefined]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 154why, one step back154expectTypeOf(undefinedFd3Result.stdio[3]).toBe<undefined>();100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 155–156why, one step back155156const undefinedArrayFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', [undefined] as const]});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 157why, one step back157expectTypeOf(undefinedArrayFd3Result.stdio[3]).toBe<undefined>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
lines 158–159why, one step back158159const ipcResult = await execa('unicorns', {ipc: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 160why, one step back160expectTypeOf(ipcResult.stdio).toBe<[undefined, string, string, undefined]>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
lines 161–162why, one step back161162const ipcInputResult = await execa('unicorns', {ipcInput: ''});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 163why, one step back163expectTypeOf(ipcInputResult.stdio).toBe<[undefined, string, string, undefined]>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
lines 164–165why, one step back164165const gracefulCancelResult = await execa('unicorns', {cancelSignal: AbortSignal.abort(), gracefulCancel: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 166why, one step back166expectTypeOf(gracefulCancelResult.stdio).toBe<[undefined, string, string, undefined]>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
line 167why, one step back167Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb
lines 168–176why, one step back168const nodeResult = await execa('unicorns', {node: true});169expectTypeOf(nodeResult.stdio).toBe<[undefined, string, string, undefined]>();170171const execaNodeResult = await execaNode('unicorns');172expectTypeOf(execaNodeResult.stdio).toBe<[undefined, string, string, undefined]>();173174const execaNodeNoIpcResult = await execaNode('unicorns', {ipc: false});175expectTypeOf(execaNodeNoIpcResult.stdio).toBe<[undefined, string, string]>();176Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
line 177why, one step back177const fd3IpcResult = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe'], ipc: true});Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 178why, one step back178expectTypeOf(fd3IpcResult.stdio).toBe<[undefined, string, string, string, undefined]>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
lines 179–180why, one step back179180const noIpcResult = await execa('unicorns');Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 181why, one step back181expectTypeOf(noIpcResult.stdio).toBe<[undefined, string, string]>();Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a
lines 182–183why, one step back182183const noIpcResultSync = execaSync('unicorns');Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147
line 184why, one step back184expectTypeOf(noIpcResultSync.stdio).toBe<[undefined, string, string]>();Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb
lines 185–187why, one step back185186const nodeResultSync = execaSync('unicorns', {node: true});187expectTypeOf(nodeResultSync.stdio).toBe<[undefined, string, string]>();