Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 1why, one step back
1import {Readable, Writable} from 'node:stream';

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 2why, one step back
2import {expectTypeOf} from 'nz';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 3–5why, one step back
3import {
4 execa,5 execaSync,

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

line 6why, one step back
6 execaNode,

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 7–11why, one step back
7 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 back
12expectTypeOf(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 back
19
20const bufferResult = await execa('unicorns', {encoding: 'buffer', all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 21–25why, one step back
21expectTypeOf(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 back
26
27const hexResult = await execa('unicorns', {encoding: 'hex', all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 28–32why, one step back
28expectTypeOf(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 back
33
34const unicornsResultSync = execaSync('unicorns', {all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 35–40why, one step back
35expectTypeOf(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 back
41
42const bufferResultSync = execaSync('unicorns', {encoding: 'buffer', all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 43–48why, one step back
43expectTypeOf(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 back
49
50const execaStringError = new Error('.') as ExecaError<{all: true}>;

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 51–56why, one step back
51expectTypeOf(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 back
57
58const execaBufferError = new Error('.') as ExecaError<{encoding: 'buffer'; all: true}>;

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 59–64why, one step back
59expectTypeOf(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 back
65
66const execaStringErrorSync = new Error('.') as ExecaSyncError<{all: true}>;

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 67–72why, one step back
67expectTypeOf(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 back
73
74const execaBufferErrorSync = new Error('.') as ExecaSyncError<{encoding: 'buffer'; all: true}>;

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 75–80why, one step back
75expectTypeOf(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 back
81
82const 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 back
83expectTypeOf(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 back
88
89const undefinedStdoutResult = await execa('unicorns', {stdout: undefined, all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 90–92why, one step back
90expectTypeOf(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 back
93
94const 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 back
95expectTypeOf(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 back
98
99const undefinedStderrResult = await execa('unicorns', {stderr: undefined, all: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 100–102why, one step back
100expectTypeOf(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 back
103
104const 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 back
105expectTypeOf(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 back
108
109const fd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', 'pipe']});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 110why, one step back
110expectTypeOf(fd3Result.stdio[3]).toBe<string>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 111–112why, one step back
111
112const 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 back
113expectTypeOf(inputFd3Result.stdio[3]).toBe<undefined>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 114why, one step back
114

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

line 115why, one step back
115const 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 back
116expectTypeOf(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 back
117

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 118why, one step back
118const 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 back
119expectTypeOf(inputInheritFd3Result.stdio[3]).toBe<undefined>();

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

lines 120–121why, one step back
120
121const 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 back
122expectTypeOf(inputFdFd3Result.stdio[3]).toBe<undefined>();

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 123why, one step back
123

Add `{value: 'pipe', input: true}` to use an additional file descriptor as input (#1246)Sindre Sorhusbefore adoption487a3a4

line 124why, one step back
124const outputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe'}]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 125why, one step back
125expectTypeOf(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 back
126

Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d

lines 127–128why, one step back
127const 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 back
129expectTypeOf(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 back
130

Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d

line 131why, one step back
131const 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 back
132const optionalInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalInputPipe]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 133why, one step back
133expectTypeOf(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 back
134
135const 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 back
137expectTypeOf(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 back
138
139const stdoutInputPipeResult = await execa('unicorns', {stdout: {value: 'pipe', input: true}});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 140–141why, one step back
140expectTypeOf(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 back
142
143const stderrInputPipeResult = await execa('unicorns', {stderr: {value: 'pipe', input: true}});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

lines 144–145why, one step back
144expectTypeOf(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 back
146

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 147why, one step back
147const 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 back
148expectTypeOf(outputFd3Result.stdio[3]).toBe<string>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 149–150why, one step back
149
150const 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 back
151expectTypeOf(bufferFd3Result.stdio[3]).toBe<Uint8Array>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 152–153why, one step back
152
153const undefinedFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', undefined]});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 154why, one step back
154expectTypeOf(undefinedFd3Result.stdio[3]).toBe<undefined>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 155–156why, one step back
155
156const 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 back
157expectTypeOf(undefinedArrayFd3Result.stdio[3]).toBe<undefined>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 158–159why, one step back
158
159const ipcResult = await execa('unicorns', {ipc: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 160why, one step back
160expectTypeOf(ipcResult.stdio).toBe<[undefined, string, string, undefined]>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 161–162why, one step back
161
162const ipcInputResult = await execa('unicorns', {ipcInput: ''});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 163why, one step back
163expectTypeOf(ipcInputResult.stdio).toBe<[undefined, string, string, undefined]>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 164–165why, one step back
164
165const gracefulCancelResult = await execa('unicorns', {cancelSignal: AbortSignal.abort(), gracefulCancel: true});

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 166why, one step back
166expectTypeOf(gracefulCancelResult.stdio).toBe<[undefined, string, string, undefined]>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

line 167why, one step back
167

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

lines 168–176why, one step back
168const 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]>();176

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

line 177why, one step back
177const 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 back
178expectTypeOf(fd3IpcResult.stdio).toBe<[undefined, string, string, string, undefined]>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 179–180why, one step back
179
180const noIpcResult = await execa('unicorns');

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 181why, one step back
181expectTypeOf(noIpcResult.stdio).toBe<[undefined, string, string]>();

Fix documentation and types mistakesSindre Sorhusbefore adoption74b854a

lines 182–183why, one step back
182
183const noIpcResultSync = execaSync('unicorns');

Move type tests from `tsd` to `nz`Sindre Sorhusbefore adoption2141147

line 184why, one step back
184expectTypeOf(noIpcResultSync.stdio).toBe<[undefined, string, string]>();

Fix `execaNode()` and the `node` option missing IPC in their typesSindre Sorhusbefore adoption2633abb

lines 185–187why, one step back
185
186const nodeResultSync = execaSync('unicorns', {node: true});187expectTypeOf(nodeResultSync.stdio).toBe<[undefined, string, string]>();