Skip to content
Myr

options.test-d.ts

This file

Path

test-d/arguments/options.test-d.ts

295 lines · 13.3 KiB · TypeScript

Last changed by

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

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 * as process from 'node:process';

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

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 3–11why, one step back
3import {
4 execa,5 execaSync,6 type Options,7 type SyncOptions,8} from '../../index.js';910const fileUrl = new URL('file:///test');11

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

lines 12–17why, one step back
12({preferLocal: false}) satisfies Options;
13({cleanup: false}) satisfies Options;14expectTypeOf<{other: false}>().not.toBeAssignableTo<Options>();15({preferLocal: false}) satisfies SyncOptions;16expectTypeOf<{cleanup: false}>().not.toBeAssignableTo<SyncOptions>();17expectTypeOf<{other: false}>().not.toBeAssignableTo<SyncOptions>();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 18–20why, one step back
18
19await execa('unicorns', {preferLocal: false});20execaSync('unicorns', {preferLocal: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 21–22why, one step back
21await execa('unicorns', {preferLocal: false as boolean});
22execaSync('unicorns', {preferLocal: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 23–27why, one step back
23expectError(await execa('unicorns', {preferLocal: 'false'}));
24expectError(execaSync('unicorns', {preferLocal: 'false'}));2526await execa('unicorns', {localDir: '.'});27execaSync('unicorns', {localDir: '.'});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 28–29why, one step back
28await execa('unicorns', {localDir: '.'});
29execaSync('unicorns', {localDir: '.'});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 30–36why, one step back
30await execa('unicorns', {localDir: fileUrl});
31execaSync('unicorns', {localDir: fileUrl});32expectError(await execa('unicorns', {localDir: false}));33expectError(execaSync('unicorns', {localDir: false}));3435await execa('unicorns', {node: true});36execaSync('unicorns', {node: true});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 37–38why, one step back
37await execa('unicorns', {node: true as boolean});
38execaSync('unicorns', {node: true as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 39–43why, one step back
39expectError(await execa('unicorns', {node: 'true'}));
40expectError(execaSync('unicorns', {node: 'true'}));4142await execa('unicorns', {nodePath: './node'});43execaSync('unicorns', {nodePath: './node'});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 44–45why, one step back
44await execa('unicorns', {nodePath: './node'});
45execaSync('unicorns', {nodePath: './node'});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 46–52why, one step back
46await execa('unicorns', {nodePath: fileUrl});
47execaSync('unicorns', {nodePath: fileUrl});48expectError(await execa('unicorns', {nodePath: false}));49expectError(execaSync('unicorns', {nodePath: false}));5051await execa('unicorns', {nodeOptions: ['--async-stack-traces'] as const});52execaSync('unicorns', {nodeOptions: ['--async-stack-traces'] as const});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 53–54why, one step back
53await execa('unicorns', {nodeOptions: ['--async-stack-traces'] as string[]});
54execaSync('unicorns', {nodeOptions: ['--async-stack-traces'] as string[]});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 55–59why, one step back
55expectError(await execa('unicorns', {nodeOptions: [false] as const}));
56expectError(execaSync('unicorns', {nodeOptions: [false] as const}));5758await execa('unicorns', {input: ''});59execaSync('unicorns', {input: ''});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 60–61why, one step back
60await execa('unicorns', {input: ''});
61execaSync('unicorns', {input: ''});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 62–70why, one step back
62await execa('unicorns', {input: new Uint8Array()});
63execaSync('unicorns', {input: new Uint8Array()});64await execa('unicorns', {input: process.stdin});65execaSync('unicorns', {input: process.stdin});66expectError(await execa('unicorns', {input: false}));67expectError(execaSync('unicorns', {input: false}));6869await execa('unicorns', {inputFile: ''});70execaSync('unicorns', {inputFile: ''});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 71–72why, one step back
71await execa('unicorns', {inputFile: ''});
72execaSync('unicorns', {inputFile: ''});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 73–79why, one step back
73await execa('unicorns', {inputFile: fileUrl});
74execaSync('unicorns', {inputFile: fileUrl});75expectError(await execa('unicorns', {inputFile: false}));76expectError(execaSync('unicorns', {inputFile: false}));7778await execa('unicorns', {lines: false});79execaSync('unicorns', {lines: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 80–81why, one step back
80await execa('unicorns', {lines: false as boolean});
81execaSync('unicorns', {lines: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 82–86why, one step back
82expectError(await execa('unicorns', {lines: 'false'}));
83expectError(execaSync('unicorns', {lines: 'false'}));8485await execa('unicorns', {reject: false});86execaSync('unicorns', {reject: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 87–88why, one step back
87await execa('unicorns', {reject: false as boolean});
88execaSync('unicorns', {reject: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 89–93why, one step back
89expectError(await execa('unicorns', {reject: 'false'}));
90expectError(execaSync('unicorns', {reject: 'false'}));9192await execa('unicorns', {stripFinalNewline: false});93execaSync('unicorns', {stripFinalNewline: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 94–95why, one step back
94await execa('unicorns', {stripFinalNewline: false as boolean});
95execaSync('unicorns', {stripFinalNewline: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 96–100why, one step back
96expectError(await execa('unicorns', {stripFinalNewline: 'false'}));
97expectError(execaSync('unicorns', {stripFinalNewline: 'false'}));9899await execa('unicorns', {extendEnv: false});100execaSync('unicorns', {extendEnv: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 101–102why, one step back
101await execa('unicorns', {extendEnv: false as boolean});
102execaSync('unicorns', {extendEnv: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 103–107why, one step back
103expectError(await execa('unicorns', {extendEnv: 'false'}));
104expectError(execaSync('unicorns', {extendEnv: 'false'}));105106await execa('unicorns', {cwd: '.'});107execaSync('unicorns', {cwd: '.'});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 108–109why, one step back
108await execa('unicorns', {cwd: '.'});
109execaSync('unicorns', {cwd: '.'});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 110–114why, one step back
110await execa('unicorns', {cwd: fileUrl});
111execaSync('unicorns', {cwd: fileUrl});112expectError(await execa('unicorns', {cwd: false}));113expectError(execaSync('unicorns', {cwd: false}));114

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

line 115why, one step back
115/* eslint-disable @typescript-eslint/naming-convention -- `PATH` is a real environment variable name */

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 116–117why, one step back
116await execa('unicorns', {env: {PATH: ''}});
117execaSync('unicorns', {env: {PATH: ''}});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 118–120why, one step back
118const env: Record<string, string> = {PATH: ''};
119await execa('unicorns', {env});120execaSync('unicorns', {env});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 121–126why, one step back
121/* eslint-enable @typescript-eslint/naming-convention */
122expectError(await execa('unicorns', {env: false}));123expectError(execaSync('unicorns', {env: false}));124125await execa('unicorns', {argv0: ''});126execaSync('unicorns', {argv0: ''});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 127–128why, one step back
127await execa('unicorns', {argv0: ''});
128execaSync('unicorns', {argv0: ''});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 129–133why, one step back
129expectError(await execa('unicorns', {argv0: false}));
130expectError(execaSync('unicorns', {argv0: false}));131132await execa('unicorns', {uid: 0});133execaSync('unicorns', {uid: 0});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 134–135why, one step back
134await execa('unicorns', {uid: 0});
135execaSync('unicorns', {uid: 0});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 136–140why, one step back
136expectError(await execa('unicorns', {uid: '0'}));
137expectError(execaSync('unicorns', {uid: '0'}));138139await execa('unicorns', {gid: 0});140execaSync('unicorns', {gid: 0});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 141–142why, one step back
141await execa('unicorns', {gid: 0});
142execaSync('unicorns', {gid: 0});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 143–147why, one step back
143expectError(await execa('unicorns', {gid: '0'}));
144expectError(execaSync('unicorns', {gid: '0'}));145146await execa('unicorns', {shell: true});147execaSync('unicorns', {shell: true});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 148–149why, one step back
148await execa('unicorns', {shell: true as boolean});
149execaSync('unicorns', {shell: true as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 150–151why, one step back
150await execa('unicorns', {shell: '/bin/sh'});
151execaSync('unicorns', {shell: '/bin/sh'});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 152–153why, one step back
152await execa('unicorns', {shell: '/bin/sh'});
153execaSync('unicorns', {shell: '/bin/sh'});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 154–160why, one step back
154await execa('unicorns', {shell: fileUrl});
155execaSync('unicorns', {shell: fileUrl});156expectError(await execa('unicorns', {shell: {}}));157expectError(execaSync('unicorns', {shell: {}}));158159await execa('unicorns', {timeout: 1000});160execaSync('unicorns', {timeout: 1000});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 161–162why, one step back
161await execa('unicorns', {timeout: 1000});
162execaSync('unicorns', {timeout: 1000});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 163–167why, one step back
163expectError(await execa('unicorns', {timeout: '1000'}));
164expectError(execaSync('unicorns', {timeout: '1000'}));165166await execa('unicorns', {maxBuffer: 1000});167execaSync('unicorns', {maxBuffer: 1000});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 168–169why, one step back
168await execa('unicorns', {maxBuffer: 1000});
169execaSync('unicorns', {maxBuffer: 1000});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 170–174why, one step back
170expectError(await execa('unicorns', {maxBuffer: '1000'}));
171expectError(execaSync('unicorns', {maxBuffer: '1000'}));172173await execa('unicorns', {killSignal: 'SIGTERM'});174execaSync('unicorns', {killSignal: 'SIGTERM'});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 175–176why, one step back
175expectError(await execa('unicorns', {killSignal: 'SIGTERM' as string}));
176expectError(execaSync('unicorns', {killSignal: 'SIGTERM' as string}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 177–178why, one step back
177await execa('unicorns', {killSignal: 9});
178execaSync('unicorns', {killSignal: 9});

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

lines 179–180why, one step back
179await execa('unicorns', {killSignal: 9});
180execaSync('unicorns', {killSignal: 9});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 181–182why, one step back
181expectError(await execa('unicorns', {killSignal: false}));
182expectError(execaSync('unicorns', {killSignal: false}));

Improve validation and typing of signals (#1025)ehmickybefore adoption7213287

lines 183–194why, one step back
183expectError(await execa('unicorns', {killSignal: 'Sigterm'}));
184expectError(execaSync('unicorns', {killSignal: 'Sigterm'}));185expectError(await execa('unicorns', {killSignal: 'sigterm'}));186expectError(execaSync('unicorns', {killSignal: 'sigterm'}));187expectError(await execa('unicorns', {killSignal: 'SIGOTHER'}));188expectError(execaSync('unicorns', {killSignal: 'SIGOTHER'}));189expectError(await execa('unicorns', {killSignal: 'SIGEMT'}));190expectError(execaSync('unicorns', {killSignal: 'SIGEMT'}));191expectError(await execa('unicorns', {killSignal: 'SIGCLD'}));192expectError(execaSync('unicorns', {killSignal: 'SIGCLD'}));193expectError(await execa('unicorns', {killSignal: 'SIGRT1'}));194expectError(execaSync('unicorns', {killSignal: 'SIGRT1'}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 195–197why, one step back
195
196await execa('unicorns', {forceKillAfterDelay: false});197expectError(execaSync('unicorns', {forceKillAfterDelay: false}));

Fix type of `forceKillAfterDelay` option (#1116)ehmickybefore adoption4f64270

lines 198–201why, one step back
198await execa('unicorns', {forceKillAfterDelay: true});
199expectError(execaSync('unicorns', {forceKillAfterDelay: true}));200await execa('unicorns', {forceKillAfterDelay: false as boolean});201expectError(execaSync('unicorns', {forceKillAfterDelay: false as boolean}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 202–203why, one step back
202await execa('unicorns', {forceKillAfterDelay: 42});
203expectError(execaSync('unicorns', {forceKillAfterDelay: 42}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 204–205why, one step back
204await execa('unicorns', {forceKillAfterDelay: 42 as number});
205expectError(execaSync('unicorns', {forceKillAfterDelay: 42 as number}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 206–210why, one step back
206expectError(await execa('unicorns', {forceKillAfterDelay: 'true'}));
207expectError(execaSync('unicorns', {forceKillAfterDelay: 'true'}));208209await execa('unicorns', {windowsVerbatimArguments: true});210execaSync('unicorns', {windowsVerbatimArguments: true});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 211–212why, one step back
211await execa('unicorns', {windowsVerbatimArguments: true as boolean});
212execaSync('unicorns', {windowsVerbatimArguments: true as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 213–217why, one step back
213expectError(await execa('unicorns', {windowsVerbatimArguments: 'true'}));
214expectError(execaSync('unicorns', {windowsVerbatimArguments: 'true'}));215216await execa('unicorns', {windowsHide: false});217execaSync('unicorns', {windowsHide: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 218–219why, one step back
218await execa('unicorns', {windowsHide: false as boolean});
219execaSync('unicorns', {windowsHide: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 220–224why, one step back
220expectError(await execa('unicorns', {windowsHide: 'false'}));
221expectError(execaSync('unicorns', {windowsHide: 'false'}));222223await execa('unicorns', {cleanup: false});224expectError(execaSync('unicorns', {cleanup: false}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 225–226why, one step back
225await execa('unicorns', {cleanup: false as boolean});
226expectError(execaSync('unicorns', {cleanup: false as boolean}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 227–231why, one step back
227expectError(await execa('unicorns', {cleanup: 'false'}));
228expectError(execaSync('unicorns', {cleanup: 'false'}));229230await execa('unicorns', {buffer: false});231execaSync('unicorns', {buffer: false});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 232–233why, one step back
232await execa('unicorns', {buffer: false as boolean});
233execaSync('unicorns', {buffer: false as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 234–238why, one step back
234expectError(await execa('unicorns', {buffer: 'false'}));
235expectError(execaSync('unicorns', {buffer: 'false'}));236237await execa('unicorns', {all: true});238execaSync('unicorns', {all: true});

Add more type tests (#1117)ehmickybefore adoption077749d

lines 239–240why, one step back
239await execa('unicorns', {all: true as boolean});
240execaSync('unicorns', {all: true as boolean});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 241–245why, one step back
241expectError(await execa('unicorns', {all: 'true'}));
242expectError(execaSync('unicorns', {all: 'true'}));243244await execa('unicorns', {ipc: true});245expectError(execaSync('unicorns', {ipc: true}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 246–247why, one step back
246await execa('unicorns', {ipc: true as boolean});
247expectError(execaSync('unicorns', {ipc: true as boolean}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 248–254why, one step back
248expectError(await execa('unicorns', {ipc: 'true'}));
249expectError(execaSync('unicorns', {ipc: 'true'}));250251await execa('unicorns', {serialization: 'json'});252expectError(execaSync('unicorns', {serialization: 'json'}));253await execa('unicorns', {serialization: 'advanced'});254expectError(execaSync('unicorns', {serialization: 'advanced'}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 255–256why, one step back
255expectError(await execa('unicorns', {serialization: 'advanced' as string}));
256expectError(execaSync('unicorns', {serialization: 'advanced' as string}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 257–259why, one step back
257expectError(await execa('unicorns', {serialization: 'other'}));
258expectError(execaSync('unicorns', {serialization: 'other'}));259

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 260–261why, one step back
260await execa('unicorns', {ipcInput: ''});
261expectError(execaSync('unicorns', {ipcInput: ''}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 262–263why, one step back
262await execa('unicorns', {ipcInput: '' as string});
263expectError(execaSync('unicorns', {ipcInput: '' as string}));

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 264–270why, one step back
264await execa('unicorns', {ipcInput: {}});
265expectError(execaSync('unicorns', {ipcInput: {}}));266await execa('unicorns', {ipcInput: undefined});267execaSync('unicorns', {ipcInput: undefined});268expectError(await execa('unicorns', {ipcInput: 0n}));269expectError(execaSync('unicorns', {ipcInput: 0n}));270

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 271–272why, one step back
271await execa('unicorns', {detached: true});
272expectError(execaSync('unicorns', {detached: true}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 273–274why, one step back
273await execa('unicorns', {detached: true as boolean});
274expectError(execaSync('unicorns', {detached: true as boolean}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 275–277why, one step back
275expectError(await execa('unicorns', {detached: 'true'}));
276expectError(execaSync('unicorns', {detached: 'true'}));277

Add `killDescendants` option to also terminate descendant processes (#1256)Sindre Sorhusbefore adoption84fa0ec

lines 278–284why, one step back
278await execa('unicorns', {killDescendants: true});
279expectError(execaSync('unicorns', {killDescendants: true}));280await execa('unicorns', {killDescendants: true as boolean});281expectError(execaSync('unicorns', {killDescendants: true as boolean}));282expectError(await execa('unicorns', {killDescendants: 'true'}));283expectError(execaSync('unicorns', {killDescendants: 'true'}));284

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 285–286why, one step back
285await execa('unicorns', {cancelSignal: AbortSignal.abort()});
286expectError(execaSync('unicorns', {cancelSignal: AbortSignal.abort()}));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 287–288why, one step back
287expectError(await execa('unicorns', {cancelSignal: false}));
288expectError(execaSync('unicorns', {cancelSignal: false}));

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 289–291why, one step back
289
290await execa('unicorns', {gracefulCancel: true, cancelSignal: AbortSignal.abort()});291expectError(execaSync('unicorns', {gracefulCancel: true, cancelSignal: AbortSignal.abort()}));

Add more type tests (#1117)ehmickybefore adoption077749d

lines 292–293why, one step back
292await execa('unicorns', {gracefulCancel: true as boolean, cancelSignal: AbortSignal.abort()});
293expectError(execaSync('unicorns', {gracefulCancel: true as boolean, cancelSignal: AbortSignal.abort()}));

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 294–295why, one step back
294expectError(await execa('unicorns', {gracefulCancel: 'true', cancelSignal: AbortSignal.abort()}));
295expectError(execaSync('unicorns', {gracefulCancel: 'true', cancelSignal: AbortSignal.abort()}));