Skip to content
Myr

Improve types of synchronous methods (#678)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 95e5754 · Browse files · 2 files+411 added−231 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+411 added−231 removed

  • other:+411 added−231 removed

2 files+411 added−231 removed

modified:index.d.ts+130 added-162 removed
13 unmodified lines
14 | undefined15 | URL16 | {file: string};1718type InputStdioOption =19 | Iterable<string | Uint8Array>18type InputStdioOption<IsSync extends boolean = boolean> = IsSync extends true19 ? Uint8Array20 : Iterable<string | Uint8Array>21 | AsyncIterable<string | Uint8Array>22 | Uint8Array23 | Readable24 | ReadableStream;2525type OutputStdioOption =26 | Writable26type OutputStdioOption<IsSync extends boolean = boolean> = IsSync extends true27 ? never28 : Writable29 | WritableStream;3029export type StdinOption =30 CommonStdioOption | InputStdioOption31 | Array<CommonStdioOption | InputStdioOption>;32export type StdoutStderrOption =33 CommonStdioOption | OutputStdioOption34 | Array<CommonStdioOption | OutputStdioOption>;35export type StdioOption =36 CommonStdioOption | InputStdioOption | OutputStdioOption37 | Array<CommonStdioOption | InputStdioOption | OutputStdioOption>;31export type StdinOption<IsSync extends boolean = boolean> =32 CommonStdioOption | InputStdioOption<IsSync>33 | Array<CommonStdioOption | InputStdioOption<IsSync>>;34export type StdoutStderrOption<IsSync extends boolean = boolean> =35 CommonStdioOption | OutputStdioOption<IsSync>36 | Array<CommonStdioOption | OutputStdioOption<IsSync>>;37export type StdioOption<IsSync extends boolean = boolean> =38 CommonStdioOption | InputStdioOption | OutputStdioOption<IsSync>39 | Array<CommonStdioOption | InputStdioOption | OutputStdioOption<IsSync>>;4039type StdioOptions =41type StdioOptions<IsSync extends boolean = boolean> =42 | BaseStdioOption41 | readonly [StdinOption, StdoutStderrOption, StdoutStderrOption, ...StdioOption[]];43 | readonly [StdinOption<IsSync>, StdoutStderrOption<IsSync>, StdoutStderrOption<IsSync>, ...Array<StdioOption<IsSync>>];4445type EncodingOption =46 | 'utf8'47 // eslint-disable-next-line unicorn/text-encoding-identifier-case
15 unmodified lines
6364type GetStdoutStderrType<EncodingType extends EncodingOption> =65 EncodingType extends DefaultEncodingOption ? string : Uint8Array;6665export type CommonOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {67export type Options<IsSync extends boolean = boolean, EncodingType extends EncodingOption = DefaultEncodingOption> = {68 /**67 Kill the spawned process when the parent process exits unless either:68 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)69 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit7071 @default true72 */73 readonly cleanup?: boolean;7475 /**69 Prefer locally installed binaries when looking for a binary to execute.7071 If you `$ npm install foo`, you can then `execa('foo')`.72
21 unmodified lines
94 */95 readonly execPath?: string | URL;9697 /**105 Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.98 Write some input to the child process' `stdin`.99107 If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.100 See also the `inputFile` and `stdin` options.101 */102 readonly input?: IsSync extends true ? string | Uint8Array : string | Uint8Array | Readable;103109 @default true104 /**105 Use a file as input to the child process' `stdin`.106107 See also the `input` and `stdin` options.108 */111 readonly buffer?: boolean;109 readonly inputFile?: string | URL;110111 /**112 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard input. This can be:113 - `'pipe'`: Sets [`childProcess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin) stream.
12 unmodified lines
126 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.127128 @default `inherit` with `$`, `pipe` otherwise129 */132 readonly stdin?: StdinOption;130 readonly stdin?: StdinOption<IsSync>;131132 /**133 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard output. This can be:134 - `'pipe'`: Sets `childProcessResult.stdout` (as a string or `Uint8Array`) and [`childProcess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).
10 unmodified lines
145 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.146147 @default 'pipe'148 */151 readonly stdout?: StdoutStderrOption;149 readonly stdout?: StdoutStderrOption<IsSync>;150151 /**152 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard error. This can be:153 - `'pipe'`: Sets `childProcessResult.stderr` (as a string or `Uint8Array`) and [`childProcess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).
10 unmodified lines
164 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.165166 @default 'pipe'167 */170 readonly stderr?: StdoutStderrOption;168 readonly stderr?: StdoutStderrOption<IsSync>;169170 /**171 Like the `stdin`, `stdout` and `stderr` options but for all file descriptors at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.172
2 unmodified lines
175 The array can have more than 3 items, to create additional file descriptors beyond `stdin`/`stdout`/`stderr`. For example, `{stdio: ['pipe', 'pipe', 'pipe', 'ipc']}` sets a fourth file descriptor `'ipc'`.176177 @default 'pipe'178 */181 readonly stdio?: StdioOptions;179 readonly stdio?: StdioOptions<IsSync>;180181 /**182 Setting this to `false` resolves the promise with the error instead of rejecting it.183
1 unmodified line
185 */186 readonly reject?: boolean;187188 /**191 Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.192193 @default false194 */195 readonly all?: boolean;196197 /**189 Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.190191 @default true192 */
25 unmodified lines
218 */219 readonly argv0?: string;220221 /**231 Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:232 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.233 - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)234235 [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)236237 @default 'json'238 */239 readonly serialization?: 'json' | 'advanced';240241 /**242 Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).243244 @default false245 */246 readonly detached?: boolean;247248 /**222 Sets the user identity of the process.223 */224 readonly uid?: number;225
42 unmodified lines
268 */269 readonly killSignal?: string | number;270271 /**299 You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).300301 When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.302303 @example304 ```305 import {execa} from 'execa';306307 const abortController = new AbortController();308 const subprocess = execa('node', [], {signal: abortController.signal});309310 setTimeout(() => {311 abortController.abort();312 }, 1000);313314 try {315 await subprocess;316 } catch (error) {317 console.log(error.isTerminated); // true318 console.log(error.isCanceled); // true319 }320 ```321 */322 readonly signal?: AbortSignal;323324 /**272 If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.273274 @default false275 */
13 unmodified lines
289290 @default false291 */292 readonly verbose?: boolean;346};293} & (IsSync extends true ? {} : {294 /**295 Kill the spawned process when the parent process exits unless either:296 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)297 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit298348export type Options<EncodingType extends EncodingOption = DefaultEncodingOption> = {299 @default true300 */301 readonly cleanup?: boolean;302303 /**350 Write some input to the child process' `stdin`.304 Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.305352 See also the `inputFile` and `stdin` options.306 If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.307308 @default true309 */354 readonly input?: string | Uint8Array | Readable;310 readonly buffer?: boolean;311312 /**357 Use a file as input to the child process' `stdin`.313 Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.314359 See also the `input` and `stdin` options.315 @default false316 */361 readonly inputFile?: string | URL;362} & CommonOptions<EncodingType>;317 readonly all?: boolean;318364export type SyncOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {319 /**366 Write some input to the `stdin` of your binary.320 Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:321 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.322 - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)323368 If the input is a file, use the `inputFile` option instead.324 [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)325326 @default 'json'327 */370 readonly input?: string | Uint8Array;328 readonly serialization?: 'json' | 'advanced';329330 /**373 Use a file as input to the the `stdin` of your binary.331 Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).332375 If the input is not a file, use the `input` option instead.333 @default false334 */377 readonly inputFile?: string;378} & CommonOptions<EncodingType>;335 readonly detached?: boolean;336337 /**338 You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).339340 When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.341342 @example343 ```344 import {execa} from 'execa';345346 const abortController = new AbortController();347 const subprocess = execa('node', [], {signal: abortController.signal});348349 setTimeout(() => {350 abortController.abort();351 }, 1000);352353 try {354 await subprocess;355 } catch (error) {356 console.log(error.isTerminated); // true357 console.log(error.isCanceled); // true358 }359 ```360 */361 readonly signal?: AbortSignal;362});363364export type SyncOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = Options<true, EncodingType>;365366export type NodeOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {367 /**368 The Node.js executable to use.369
6 unmodified lines
376377 @default process.execArgv378 */379 readonly nodeOptions?: string[];394} & Options<EncodingType>;380} & Options<false, EncodingType>;381382type StdoutStderrAll = string | Uint8Array | undefined;383398export type ExecaReturnBase<StdoutStderrType extends StdoutStderrAll> = {384/**385Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.386387The child process fails when:388- its exit code is not `0`389- it was terminated with a signal390- timing out391- being canceled392- there's not enough memory or there are already too many child processes393*/394export type ExecaReturnValue<IsSync extends boolean, StdoutStderrType extends StdoutStderrAll = string> = {395 /**396 The file and arguments that were run, for logging purposes.397398 This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
65 unmodified lines
464 /**465 The `cwd` of the command if provided in the command options. Otherwise it is `process.cwd()`.466 */467 cwd: string;472};468474export type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {475} & ExecaReturnBase<StdoutStderrType>;469 /**470 Whether the process was canceled.471477/**478Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.479480The child process fails when:481- its exit code is not `0`482- it was terminated with a signal483- timing out484- being canceled485- there's not enough memory or there are already too many child processes486*/487export type ExecaReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {472 You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.473 */474 isCanceled: boolean;475} & (IsSync extends true ? {} : {476 /**477 The output of the process with `stdout` and `stderr` interleaved.478479 This is `undefined` if either:480 - the `all` option is `false` (default value)493 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)481 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)482 */483 all?: StdoutStderrType;484});485497 /**498 Whether the process was canceled.486type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = ExecaReturnValue<true, StdoutStderrType>;487500 You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.501 */502 isCanceled: boolean;503} & ExecaSyncReturnValue<StdoutStderrType>;504505export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = {488export type ExecaError<IsSync extends boolean = boolean, StdoutStderrType extends StdoutStderrAll = string> = {489 /**490 Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.491492 The child process `stderr` then `stdout` are appended to the end, separated with newlines and not interleaved.
10 unmodified lines
503504 This is `undefined` unless the child process exited due to an `error` event or a timeout.505 */506 originalMessage?: string;524} & Error & ExecaReturnBase<StdoutStderrType>;507} & Error & ExecaReturnValue<IsSync, StdoutStderrType>;508526export type ExecaError<StdoutStderrType extends StdoutStderrAll = string> = {527 /**528 The output of the process with `stdout` and `stderr` interleaved.509export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = ExecaError<true, StdoutStderrType>;510530 This is `undefined` if either:531 - the `all` option is `false` (default value)532 - `execaSync()` was used533 */534 all?: StdoutStderrType;535536 /**537 Whether the process was canceled.538 */539 isCanceled: boolean;540} & ExecaSyncError<StdoutStderrType>;541511export type KillOptions = {512 /**513 Milliseconds to wait for the child process to terminate before sending `SIGKILL`.514
14 unmodified lines
529 */530 all?: Readable;531532 catch<ResultType = never>(564 onRejected?: (reason: ExecaError<StdoutStderrType>) => ResultType | PromiseLike<ResultType>565 ): Promise<ExecaReturnValue<StdoutStderrType> | ResultType>;533 onRejected?: (reason: ExecaError<false, StdoutStderrType>) => ResultType | PromiseLike<ResultType>534 ): Promise<ExecaReturnValue<false, StdoutStderrType> | ResultType>;535536 /**537 Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill).538 */
35 unmodified lines
574};575576export type ExecaChildProcess<StdoutStderrType extends StdoutStderrAll = string> = ChildProcess &577ExecaChildPromise<StdoutStderrType> &609Promise<ExecaReturnValue<StdoutStderrType>>;578Promise<ExecaReturnValue<false, StdoutStderrType>>;579580/**581Executes a command using `file ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a `childProcess`.582
107 unmodified lines
690*/691export function execa<EncodingType extends EncodingOption = DefaultEncodingOption>(692 file: string | URL,693 arguments?: readonly string[],725 options?: Options<EncodingType>694 options?: Options<false, EncodingType>695): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;696export function execa<EncodingType extends EncodingOption = DefaultEncodingOption>(697 file: string | URL,729 options?: Options<EncodingType>698 options?: Options<false, EncodingType>699): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;700701/**702Same as `execa()` but synchronous.
59 unmodified lines
762*/763export function execaSync<EncodingType extends EncodingOption = DefaultEncodingOption>(764 file: string | URL,765 arguments?: readonly string[],797 options?: SyncOptions<EncodingType>798): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;766 options?: Options<true, EncodingType>767): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;768export function execaSync<EncodingType extends EncodingOption = DefaultEncodingOption>(769 file: string | URL,801 options?: SyncOptions<EncodingType>802): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;770 options?: Options<true, EncodingType>771): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;772773/**774Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.775
16 unmodified lines
792//=> 'unicorns'793```794*/795export function execaCommand<EncodingType extends EncodingOption = DefaultEncodingOption>(827 command: string, options?: Options<EncodingType>796 command: string, options?: Options<false, EncodingType>797): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;798799/**800Same as `execaCommand()` but synchronous.
13 unmodified lines
814//=> 'unicorns'815```816*/817export function execaCommandSync<EncodingType extends EncodingOption = DefaultEncodingOption>(849 command: string, options?: SyncOptions<EncodingType>850): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;818 command: string, options?: Options<true, EncodingType>819): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;820821type TemplateExpression =822 | string823 | number855 | ExecaReturnValue<string | Uint8Array>856 | ExecaSyncReturnValue<string | Uint8Array>857 | Array<string | number | ExecaReturnValue<string | Uint8Array> | ExecaSyncReturnValue<string | Uint8Array>>;824 | ExecaReturnValue<boolean, string | Uint8Array>825 | Array<string | number | ExecaReturnValue<boolean, string | Uint8Array>>;826827type Execa$<StdoutStderrType extends StdoutStderrAll = string> = {828 /**829 Returns a new instance of `$` but with different default `options`. Consecutive calls are merged to previous ones.
17 unmodified lines
847 await $$`echo rainbows`;848 //=> 'rainbows'849 ```850 */883 (options: Options<undefined>): Execa$<StdoutStderrType>;884 (options: Options): Execa$;885 (options: Options<BufferEncodingOption>): Execa$<Uint8Array>;851 (options: Options<false, undefined>): Execa$<StdoutStderrType>;852 (options: Options<false>): Execa$;853 (options: Options<false, BufferEncodingOption>): Execa$<Uint8Array>;854 (855 templates: TemplateStringsArray,856 ...expressions: TemplateExpression[]857 ): ExecaChildProcess<StdoutStderrType>;
47 unmodified lines
905 */906 sync(907 templates: TemplateStringsArray,908 ...expressions: TemplateExpression[]941 ): ExecaSyncReturnValue<StdoutStderrType>;909 ): ExecaReturnValue<true, StdoutStderrType>;910911 /**912 Same as $\`command\` but synchronous.913
43 unmodified lines
957 */958 s(959 templates: TemplateStringsArray,960 ...expressions: TemplateExpression[]993 ): ExecaSyncReturnValue<StdoutStderrType>;961 ): ExecaReturnValue<true, StdoutStderrType>;962};963964/**965Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.
88 unmodified lines
modified:index.test-d.ts+281 added-69 removed
2 unmodified lines
3// to get treated as `any` by `@typescript-eslint/no-unsafe-assignment`.4import * as process from 'node:process';5import {Readable, Writable} from 'node:stream';6import {createWriteStream} from 'node:fs';7import {expectType, expectError, expectAssignable} from 'tsd';7import {expectType, expectError, expectAssignable, expectNotAssignable} from 'tsd';8import {9 $,10 execa,11 execaSync,12 execaCommand,13 execaCommandSync,14 execaNode,15 type Options,16 type ExecaReturnValue,17 type ExecaChildProcess,18 type ExecaError,19 type SyncOptions,20 type ExecaSyncReturnValue,21 type ExecaSyncError,22} from './index.js';23
49 unmodified lines
73 expectType<string | undefined>(unicornsResult.signal);74 expectType<string | undefined>(unicornsResult.signalDescription);75 expectType<string>(unicornsResult.cwd);76} catch (error: unknown) {75 const execaError = error as ExecaError;77 const execaError = error as ExecaError<false>;7879 expectType<string>(execaError.message);80 expectType<number | undefined>(execaError.exitCode);81 expectType<string>(execaError.stdout);
11 unmodified lines
93}9495try {96 const unicornsResult = execaSync('unicorns');97 expectType<ExecaSyncReturnValue>(unicornsResult);98 expectType<string>(unicornsResult.command);99 expectType<string>(unicornsResult.escapedCommand);100 expectType<number | undefined>(unicornsResult.exitCode);101 expectType<string>(unicornsResult.stdout);
3 unmodified lines
105 expectError(unicornsResult.pipeStderr);106 expectError(unicornsResult.pipeAll);107 expectType<boolean>(unicornsResult.failed);108 expectType<boolean>(unicornsResult.timedOut);106 expectError(unicornsResult.isCanceled);109 expectType<boolean>(unicornsResult.isCanceled);110 expectType<boolean>(unicornsResult.isTerminated);111 expectType<string | undefined>(unicornsResult.signal);112 expectType<string | undefined>(unicornsResult.signalDescription);113 expectType<string>(unicornsResult.cwd);114} catch (error: unknown) {112 const execaError = error as ExecaSyncError;115 const execaError = error as ExecaError<true>;116117 expectType<ExecaSyncError>(execaError);118 expectType<string>(execaError.message);119 expectType<number | undefined>(execaError.exitCode);120 expectType<string>(execaError.stdout);121 expectType<string>(execaError.stderr);122 expectError(execaError.all);123 expectType<boolean>(execaError.failed);124 expectType<boolean>(execaError.timedOut);121 expectError(execaError.isCanceled);125 expectType<boolean>(execaError.isCanceled);126 expectType<boolean>(execaError.isTerminated);127 expectType<string | undefined>(execaError.signal);128 expectType<string | undefined>(execaError.signalDescription);129 expectType<string>(execaError.cwd);
18 unmodified lines
148};149150const fileUrl = new URL('file:///test');151152expectAssignable<Options>({cleanup: false});153expectNotAssignable<SyncOptions>({cleanup: false});154expectAssignable<SyncOptions>({preferLocal: false});155156/* eslint-disable @typescript-eslint/no-floating-promises */157execa('unicorns', {cleanup: false});158expectError(execaSync('unicorns', {cleanup: false}));159execa('unicorns', {preferLocal: false});160execaSync('unicorns', {preferLocal: false});161execa('unicorns', {localDir: '.'});162execaSync('unicorns', {localDir: '.'});163execa('unicorns', {localDir: fileUrl});164execaSync('unicorns', {localDir: fileUrl});165expectError(execa('unicorns', {encoding: 'unknownEncoding'}));166expectError(execaSync('unicorns', {encoding: 'unknownEncoding'}));167execa('unicorns', {execPath: '/path'});168execaSync('unicorns', {execPath: '/path'});169execa('unicorns', {execPath: fileUrl});170execaSync('unicorns', {execPath: fileUrl});171execa('unicorns', {buffer: false});172expectError(execaSync('unicorns', {buffer: false}));173execa('unicorns', {input: ''});174execaSync('unicorns', {input: ''});175execa('unicorns', {input: new Uint8Array()});176execaSync('unicorns', {input: new Uint8Array()});177execa('unicorns', {input: process.stdin});178expectError(execaSync('unicorns', {input: process.stdin}));179execa('unicorns', {inputFile: ''});180execaSync('unicorns', {inputFile: ''});181execa('unicorns', {inputFile: fileUrl});182execaSync('unicorns', {inputFile: fileUrl});183execa('unicorns', {stdin: 'pipe'});184execaSync('unicorns', {stdin: 'pipe'});185execa('unicorns', {stdin: ['pipe']});186execaSync('unicorns', {stdin: ['pipe']});187execa('unicorns', {stdin: 'overlapped'});188execaSync('unicorns', {stdin: 'overlapped'});189execa('unicorns', {stdin: ['overlapped']});190execaSync('unicorns', {stdin: ['overlapped']});191execa('unicorns', {stdin: 'ipc'});192execaSync('unicorns', {stdin: 'ipc'});193execa('unicorns', {stdin: ['ipc']});194execaSync('unicorns', {stdin: ['ipc']});195execa('unicorns', {stdin: 'ignore'});196execaSync('unicorns', {stdin: 'ignore'});197execa('unicorns', {stdin: ['ignore']});198execaSync('unicorns', {stdin: ['ignore']});199execa('unicorns', {stdin: 'inherit'});200execaSync('unicorns', {stdin: 'inherit'});201execa('unicorns', {stdin: ['inherit']});202execaSync('unicorns', {stdin: ['inherit']});203execa('unicorns', {stdin: process.stdin});204expectError(execaSync('unicorns', {stdin: process.stdin}));205execa('unicorns', {stdin: [process.stdin]});206expectError(execaSync('unicorns', {stdin: [process.stdin]}));207execa('unicorns', {stdin: new Readable()});208expectError(execaSync('unicorns', {stdin: new Readable()}));209execa('unicorns', {stdin: [new Readable()]});210expectError(execaSync('unicorns', {stdin: [new Readable()]}));211expectError(execa('unicorns', {stdin: new Writable()}));212expectError(execaSync('unicorns', {stdin: new Writable()}));213expectError(execa('unicorns', {stdin: [new Writable()]}));214expectError(execaSync('unicorns', {stdin: [new Writable()]}));215execa('unicorns', {stdin: new ReadableStream()});216expectError(execaSync('unicorns', {stdin: new ReadableStream()}));217execa('unicorns', {stdin: [new ReadableStream()]});218expectError(execaSync('unicorns', {stdin: [new ReadableStream()]}));219expectError(execa('unicorns', {stdin: new WritableStream()}));220expectError(execaSync('unicorns', {stdin: new WritableStream()}));221expectError(execa('unicorns', {stdin: [new WritableStream()]}));222expectError(execaSync('unicorns', {stdin: [new WritableStream()]}));223execa('unicorns', {stdin: new Uint8Array()});224execaSync('unicorns', {stdin: new Uint8Array()});225execa('unicorns', {stdin: stringGenerator()});226expectError(execaSync('unicorns', {stdin: stringGenerator()}));227execa('unicorns', {stdin: [stringGenerator()]});228expectError(execaSync('unicorns', {stdin: [stringGenerator()]}));229execa('unicorns', {stdin: binaryGenerator()});230expectError(execaSync('unicorns', {stdin: binaryGenerator()}));231execa('unicorns', {stdin: [binaryGenerator()]});232expectError(execaSync('unicorns', {stdin: [binaryGenerator()]}));233execa('unicorns', {stdin: asyncStringGenerator()});234expectError(execaSync('unicorns', {stdin: asyncStringGenerator()}));235execa('unicorns', {stdin: [asyncStringGenerator()]});236expectError(execaSync('unicorns', {stdin: [asyncStringGenerator()]}));237expectError(execa('unicorns', {stdin: numberGenerator()}));238expectError(execaSync('unicorns', {stdin: numberGenerator()}));239expectError(execa('unicorns', {stdin: [numberGenerator()]}));240expectError(execaSync('unicorns', {stdin: [numberGenerator()]}));241execa('unicorns', {stdin: fileUrl});242execaSync('unicorns', {stdin: fileUrl});243execa('unicorns', {stdin: [fileUrl]});244execaSync('unicorns', {stdin: [fileUrl]});245execa('unicorns', {stdin: {file: './test'}});246execaSync('unicorns', {stdin: {file: './test'}});247execa('unicorns', {stdin: [{file: './test'}]});248execaSync('unicorns', {stdin: [{file: './test'}]});249execa('unicorns', {stdin: 1});250execaSync('unicorns', {stdin: 1});251execa('unicorns', {stdin: [1]});252execaSync('unicorns', {stdin: [1]});253execa('unicorns', {stdin: undefined});254execaSync('unicorns', {stdin: undefined});255execa('unicorns', {stdin: [undefined]});256execaSync('unicorns', {stdin: [undefined]});257execa('unicorns', {stdin: ['pipe', 'inherit']});258execaSync('unicorns', {stdin: ['pipe', 'inherit']});259execa('unicorns', {stdout: 'pipe'});260execaSync('unicorns', {stdout: 'pipe'});261execa('unicorns', {stdout: ['pipe']});262execaSync('unicorns', {stdout: ['pipe']});263execa('unicorns', {stdout: 'overlapped'});264execaSync('unicorns', {stdout: 'overlapped'});265execa('unicorns', {stdout: ['overlapped']});266execaSync('unicorns', {stdout: ['overlapped']});267execa('unicorns', {stdout: 'ipc'});268execaSync('unicorns', {stdout: 'ipc'});269execa('unicorns', {stdout: ['ipc']});270execaSync('unicorns', {stdout: ['ipc']});271execa('unicorns', {stdout: 'ignore'});272execaSync('unicorns', {stdout: 'ignore'});273execa('unicorns', {stdout: ['ignore']});274execaSync('unicorns', {stdout: ['ignore']});275execa('unicorns', {stdout: 'inherit'});276execaSync('unicorns', {stdout: 'inherit'});277execa('unicorns', {stdout: ['inherit']});278execaSync('unicorns', {stdout: ['inherit']});279execa('unicorns', {stdout: process.stdout});280expectError(execaSync('unicorns', {stdout: process.stdout}));281execa('unicorns', {stdout: [process.stdout]});282expectError(execaSync('unicorns', {stdout: [process.stdout]}));283execa('unicorns', {stdout: new Writable()});284expectError(execaSync('unicorns', {stdout: new Writable()}));285execa('unicorns', {stdout: [new Writable()]});286expectError(execaSync('unicorns', {stdout: [new Writable()]}));287expectError(execa('unicorns', {stdout: new Readable()}));288expectError(execaSync('unicorns', {stdout: new Readable()}));289expectError(execa('unicorn', {stdout: [new Readable()]}));290expectError(execaSync('unicorn', {stdout: [new Readable()]}));291execa('unicorns', {stdout: new WritableStream()});292expectError(execaSync('unicorns', {stdout: new WritableStream()}));293execa('unicorns', {stdout: [new WritableStream()]});294expectError(execaSync('unicorns', {stdout: [new WritableStream()]}));295expectError(execa('unicorns', {stdout: new ReadableStream()}));296expectError(execaSync('unicorns', {stdout: new ReadableStream()}));297expectError(execa('unicorn', {stdout: [new ReadableStream()]}));298expectError(execaSync('unicorn', {stdout: [new ReadableStream()]}));299execa('unicorns', {stdout: fileUrl});300execaSync('unicorns', {stdout: fileUrl});301execa('unicorns', {stdout: [fileUrl]});302execaSync('unicorns', {stdout: [fileUrl]});303execa('unicorns', {stdout: {file: './test'}});304execaSync('unicorns', {stdout: {file: './test'}});305execa('unicorns', {stdout: [{file: './test'}]});306execaSync('unicorns', {stdout: [{file: './test'}]});307execa('unicorns', {stdout: 1});308execaSync('unicorns', {stdout: 1});309execa('unicorns', {stdout: [1]});310execaSync('unicorns', {stdout: [1]});311execa('unicorns', {stdout: undefined});312execaSync('unicorns', {stdout: undefined});313execa('unicorns', {stdout: [undefined]});314execaSync('unicorns', {stdout: [undefined]});315execa('unicorns', {stdout: ['pipe', 'inherit']});316execaSync('unicorns', {stdout: ['pipe', 'inherit']});317execa('unicorns', {stderr: 'pipe'});318execaSync('unicorns', {stderr: 'pipe'});319execa('unicorns', {stderr: ['pipe']});320execaSync('unicorns', {stderr: ['pipe']});321execa('unicorns', {stderr: 'overlapped'});322execaSync('unicorns', {stderr: 'overlapped'});323execa('unicorns', {stderr: ['overlapped']});324execaSync('unicorns', {stderr: ['overlapped']});325execa('unicorns', {stderr: 'ipc'});326execaSync('unicorns', {stderr: 'ipc'});327execa('unicorns', {stderr: ['ipc']});328execaSync('unicorns', {stderr: ['ipc']});329execa('unicorns', {stderr: 'ignore'});330execaSync('unicorns', {stderr: 'ignore'});331execa('unicorns', {stderr: ['ignore']});332execaSync('unicorns', {stderr: ['ignore']});333execa('unicorns', {stderr: 'inherit'});334execaSync('unicorns', {stderr: 'inherit'});335execa('unicorns', {stderr: ['inherit']});336execaSync('unicorns', {stderr: ['inherit']});337execa('unicorns', {stderr: process.stderr});338expectError(execaSync('unicorns', {stderr: process.stderr}));339execa('unicorns', {stderr: [process.stderr]});340expectError(execaSync('unicorns', {stderr: [process.stderr]}));341execa('unicorns', {stderr: new Writable()});342expectError(execaSync('unicorns', {stderr: new Writable()}));343execa('unicorns', {stderr: [new Writable()]});344expectError(execaSync('unicorns', {stderr: [new Writable()]}));345expectError(execa('unicorns', {stderr: new Readable()}));346expectError(execaSync('unicorns', {stderr: new Readable()}));347expectError(execa('unicorns', {stderr: [new Readable()]}));348expectError(execaSync('unicorns', {stderr: [new Readable()]}));349execa('unicorns', {stderr: new WritableStream()});350expectError(execaSync('unicorns', {stderr: new WritableStream()}));351execa('unicorns', {stderr: [new WritableStream()]});352expectError(execaSync('unicorns', {stderr: [new WritableStream()]}));353expectError(execa('unicorns', {stderr: new ReadableStream()}));354expectError(execaSync('unicorns', {stderr: new ReadableStream()}));355expectError(execa('unicorns', {stderr: [new ReadableStream()]}));356expectError(execaSync('unicorns', {stderr: [new ReadableStream()]}));357execa('unicorns', {stderr: fileUrl});358execaSync('unicorns', {stderr: fileUrl});359execa('unicorns', {stderr: [fileUrl]});360execaSync('unicorns', {stderr: [fileUrl]});361execa('unicorns', {stderr: {file: './test'}});362execaSync('unicorns', {stderr: {file: './test'}});363execa('unicorns', {stderr: [{file: './test'}]});364execaSync('unicorns', {stderr: [{file: './test'}]});365execa('unicorns', {stderr: 1});366execaSync('unicorns', {stderr: 1});367execa('unicorns', {stderr: [1]});368execaSync('unicorns', {stderr: [1]});369execa('unicorns', {stderr: undefined});370execaSync('unicorns', {stderr: undefined});371execa('unicorns', {stderr: [undefined]});372execaSync('unicorns', {stderr: [undefined]});373execa('unicorns', {stderr: ['pipe', 'inherit']});374execaSync('unicorns', {stderr: ['pipe', 'inherit']});375execa('unicorns', {all: true});376expectError(execaSync('unicorns', {all: true}));377execa('unicorns', {reject: false});378execaSync('unicorns', {reject: false});379execa('unicorns', {stripFinalNewline: false});380execaSync('unicorns', {stripFinalNewline: false});381execa('unicorns', {extendEnv: false});382execaSync('unicorns', {extendEnv: false});383execa('unicorns', {cwd: '.'});384execaSync('unicorns', {cwd: '.'});385execa('unicorns', {cwd: fileUrl});386execaSync('unicorns', {cwd: fileUrl});387// eslint-disable-next-line @typescript-eslint/naming-convention388execa('unicorns', {env: {PATH: ''}});389// eslint-disable-next-line @typescript-eslint/naming-convention390execaSync('unicorns', {env: {PATH: ''}});391execa('unicorns', {argv0: ''});392execaSync('unicorns', {argv0: ''});393execa('unicorns', {stdio: 'pipe'});394execaSync('unicorns', {stdio: 'pipe'});395execa('unicorns', {stdio: 'overlapped'});396execaSync('unicorns', {stdio: 'overlapped'});397execa('unicorns', {stdio: 'ignore'});398execaSync('unicorns', {stdio: 'ignore'});399execa('unicorns', {stdio: 'inherit'});400execaSync('unicorns', {stdio: 'inherit'});401expectError(execa('unicorns', {stdio: 'ipc'}));402expectError(execaSync('unicorns', {stdio: 'ipc'}));403expectError(execa('unicorns', {stdio: 1}));404expectError(execaSync('unicorns', {stdio: 1}));405expectError(execa('unicorns', {stdio: fileUrl}));406expectError(execaSync('unicorns', {stdio: fileUrl}));407expectError(execa('unicorns', {stdio: {file: './test'}}));408expectError(execaSync('unicorns', {stdio: {file: './test'}}));409expectError(execa('unicorns', {stdio: new Writable()}));410expectError(execaSync('unicorns', {stdio: new Writable()}));411expectError(execa('unicorns', {stdio: new Readable()}));412expectError(execaSync('unicorns', {stdio: new Readable()}));413expectError(execa('unicorns', {stdio: new WritableStream()}));414expectError(execaSync('unicorns', {stdio: new WritableStream()}));415expectError(execa('unicorns', {stdio: new ReadableStream()}));416expectError(execaSync('unicorns', {stdio: new ReadableStream()}));417expectError(execa('unicorns', {stdio: stringGenerator()}));418expectError(execaSync('unicorns', {stdio: stringGenerator()}));419expectError(execa('unicorns', {stdio: asyncStringGenerator()}));420expectError(execaSync('unicorns', {stdio: asyncStringGenerator()}));421expectError(execa('unicorns', {stdio: ['pipe', 'pipe']}));422expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe']}));423execa('unicorns', {stdio: [new Readable(), 'pipe', 'pipe']});424expectError(execaSync('unicorns', {stdio: [new Readable(), 'pipe', 'pipe']}));425execa('unicorns', {stdio: [[new Readable()], ['pipe'], ['pipe']]});426expectError(execaSync('unicorns', {stdio: [[new Readable()], ['pipe'], ['pipe']]}));427execa('unicorns', {stdio: ['pipe', new Writable(), 'pipe']});428expectError(execaSync('unicorns', {stdio: ['pipe', new Writable(), 'pipe']}));429execa('unicorns', {stdio: [['pipe'], [new Writable()], ['pipe']]});430expectError(execaSync('unicorns', {stdio: [['pipe'], [new Writable()], ['pipe']]}));431execa('unicorns', {stdio: ['pipe', 'pipe', new Writable()]});432expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', new Writable()]}));433execa('unicorns', {stdio: [['pipe'], ['pipe'], [new Writable()]]});434expectError(execaSync('unicorns', {stdio: [['pipe'], ['pipe'], [new Writable()]]}));435expectError(execa('unicorns', {stdio: [new Writable(), 'pipe', 'pipe']}));436expectError(execaSync('unicorns', {stdio: [new Writable(), 'pipe', 'pipe']}));437expectError(execa('unicorns', {stdio: [[new Writable()], ['pipe'], ['pipe']]}));438expectError(execaSync('unicorns', {stdio: [[new Writable()], ['pipe'], ['pipe']]}));439expectError(execa('unicorns', {stdio: ['pipe', new Readable(), 'pipe']}));440expectError(execaSync('unicorns', {stdio: ['pipe', new Readable(), 'pipe']}));441expectError(execa('unicorns', {stdio: [['pipe'], [new Readable()], ['pipe']]}));442expectError(execaSync('unicorns', {stdio: [['pipe'], [new Readable()], ['pipe']]}));443expectError(execa('unicorns', {stdio: ['pipe', 'pipe', new Readable()]}));444expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', new Readable()]}));445expectError(execa('unicorns', {stdio: [['pipe'], ['pipe'], [new Readable()]]}));446expectError(execaSync('unicorns', {stdio: [['pipe'], ['pipe'], [new Readable()]]}));447execa('unicorns', {448 stdio: [449 'pipe',450 'overlapped',
13 unmodified lines
464 stringGenerator(),465 asyncStringGenerator(),466 ],467});468execaSync('unicorns', {469 stdio: [470 'pipe',471 'overlapped',472 'ipc',473 'ignore',474 'inherit',475 process.stdin,476 1,477 undefined,478 fileUrl,479 {file: './test'},480 new Uint8Array(),481 ],482});483expectError(execaSync('unicorns', {stdio: [new Writable()]}));484expectError(execaSync('unicorns', {stdio: [new Readable()]}));485expectError(execaSync('unicorns', {stdio: [new WritableStream()]}));486expectError(execaSync('unicorns', {stdio: [new ReadableStream()]}));487expectError(execaSync('unicorns', {stdio: [stringGenerator()]}));488expectError(execaSync('unicorns', {stdio: [asyncStringGenerator()]}));489execa('unicorns', {490 stdio: [491 ['pipe'],492 ['pipe', 'inherit'],
9 unmodified lines
502 [new Writable()],503 [new Readable()],504 [new WritableStream()],505 [new ReadableStream()],506 [new Uint8Array()],507 [stringGenerator()],508 [asyncStringGenerator()],509 ],510});511execaSync('unicorns', {512 stdio: [513 ['pipe'],514 ['pipe', 'inherit'],515 ['overlapped'],516 ['ipc'],517 ['ignore'],518 ['inherit'],519 [process.stdin],520 [1],521 [undefined],522 [fileUrl],523 [{file: './test'}],524 [new Uint8Array()],525 ],526});527expectError(execaSync('unicorns', {stdio: [[new Writable()]]}));528expectError(execaSync('unicorns', {stdio: [[new Readable()]]}));529expectError(execaSync('unicorns', {stdio: [[new WritableStream()]]}));530expectError(execaSync('unicorns', {stdio: [[new ReadableStream()]]}));531expectError(execaSync('unicorns', {stdio: [[stringGenerator()]]}));532expectError(execaSync('unicorns', {stdio: [[asyncStringGenerator()]]}));533execa('unicorns', {serialization: 'advanced'});534expectError(execaSync('unicorns', {serialization: 'advanced'}));535execa('unicorns', {detached: true});536expectError(execaSync('unicorns', {detached: true}));537execa('unicorns', {uid: 0});538execaSync('unicorns', {uid: 0});539execa('unicorns', {gid: 0});540execaSync('unicorns', {gid: 0});541execa('unicorns', {shell: true});542execaSync('unicorns', {shell: true});543execa('unicorns', {shell: '/bin/sh'});544execaSync('unicorns', {shell: '/bin/sh'});545execa('unicorns', {shell: fileUrl});546execaSync('unicorns', {shell: fileUrl});547execa('unicorns', {timeout: 1000});548execaSync('unicorns', {timeout: 1000});549execa('unicorns', {maxBuffer: 1000});550execaSync('unicorns', {maxBuffer: 1000});551execa('unicorns', {killSignal: 'SIGTERM'});552execaSync('unicorns', {killSignal: 'SIGTERM'});553execa('unicorns', {killSignal: 9});554execaSync('unicorns', {killSignal: 9});555execa('unicorns', {signal: new AbortController().signal});556expectError(execaSync('unicorns', {signal: new AbortController().signal}));557execa('unicorns', {windowsVerbatimArguments: true});558execaSync('unicorns', {windowsVerbatimArguments: true});559execa('unicorns', {windowsHide: false});560execaSync('unicorns', {windowsHide: false});561execa('unicorns', {verbose: false});562execaSync('unicorns', {verbose: false});563/* eslint-enable @typescript-eslint/no-floating-promises */564execa('unicorns').kill();565execa('unicorns').kill('SIGKILL');566execa('unicorns').kill(undefined);
4 unmodified lines
571572expectError(execa(['unicorns', 'arg']));573expectType<ExecaChildProcess>(execa('unicorns'));574expectType<ExecaChildProcess>(execa(fileUrl));363expectType<ExecaReturnValue>(await execa('unicorns'));364expectType<ExecaReturnValue>(575expectType<ExecaReturnValue<false>>(await execa('unicorns'));576expectType<ExecaReturnValue<false>>(577 await execa('unicorns', {encoding: 'utf8'}),578);367expectType<ExecaReturnValue<Uint8Array>>(await execa('unicorns', {encoding: 'buffer'}));368expectType<ExecaReturnValue>(579expectType<ExecaReturnValue<false, Uint8Array>>(await execa('unicorns', {encoding: 'buffer'}));580expectType<ExecaReturnValue<false>>(581 await execa('unicorns', ['foo'], {encoding: 'utf8'}),582);371expectType<ExecaReturnValue<Uint8Array>>(583expectType<ExecaReturnValue<false, Uint8Array>>(584 await execa('unicorns', ['foo'], {encoding: 'buffer'}),585);586587expectError(execaSync(['unicorns', 'arg']));376expectType<ExecaSyncReturnValue>(execaSync('unicorns'));377expectType<ExecaSyncReturnValue>(execaSync(fileUrl));378expectType<ExecaSyncReturnValue>(588expectType<ExecaReturnValue<true>>(execaSync('unicorns'));589expectType<ExecaReturnValue<true>>(execaSync(fileUrl));590expectType<ExecaReturnValue<true>>(591 execaSync('unicorns', {encoding: 'utf8'}),592);381expectType<ExecaSyncReturnValue<Uint8Array>>(593expectType<ExecaReturnValue<true, Uint8Array>>(594 execaSync('unicorns', {encoding: 'buffer'}),595);384expectType<ExecaSyncReturnValue>(596expectType<ExecaReturnValue<true>>(597 execaSync('unicorns', ['foo'], {encoding: 'utf8'}),598);387expectType<ExecaSyncReturnValue<Uint8Array>>(599expectType<ExecaReturnValue<true, Uint8Array>>(600 execaSync('unicorns', ['foo'], {encoding: 'buffer'}),601);602603expectType<ExecaChildProcess>(execaCommand('unicorns'));392expectType<ExecaReturnValue>(await execaCommand('unicorns'));393expectType<ExecaReturnValue>(await execaCommand('unicorns', {encoding: 'utf8'}));394expectType<ExecaReturnValue<Uint8Array>>(await execaCommand('unicorns', {encoding: 'buffer'}));395expectType<ExecaReturnValue>(await execaCommand('unicorns foo', {encoding: 'utf8'}));396expectType<ExecaReturnValue<Uint8Array>>(await execaCommand('unicorns foo', {encoding: 'buffer'}));604expectType<ExecaReturnValue<false>>(await execaCommand('unicorns'));605expectType<ExecaReturnValue<false>>(await execaCommand('unicorns', {encoding: 'utf8'}));606expectType<ExecaReturnValue<false, Uint8Array>>(await execaCommand('unicorns', {encoding: 'buffer'}));607expectType<ExecaReturnValue<false>>(await execaCommand('unicorns foo', {encoding: 'utf8'}));608expectType<ExecaReturnValue<false, Uint8Array>>(await execaCommand('unicorns foo', {encoding: 'buffer'}));609398expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns'));399expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns', {encoding: 'utf8'}));400expectType<ExecaSyncReturnValue<Uint8Array>>(execaCommandSync('unicorns', {encoding: 'buffer'}));401expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns foo', {encoding: 'utf8'}));402expectType<ExecaSyncReturnValue<Uint8Array>>(execaCommandSync('unicorns foo', {encoding: 'buffer'}));610expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns'));611expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns', {encoding: 'utf8'}));612expectType<ExecaReturnValue<true, Uint8Array>>(execaCommandSync('unicorns', {encoding: 'buffer'}));613expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns foo', {encoding: 'utf8'}));614expectType<ExecaReturnValue<true, Uint8Array>>(execaCommandSync('unicorns foo', {encoding: 'buffer'}));615616expectError(execaNode(['unicorns', 'arg']));617expectType<ExecaChildProcess>(execaNode('unicorns'));406expectType<ExecaReturnValue>(await execaNode('unicorns'));407expectType<ExecaReturnValue>(await execaNode(fileUrl));408expectType<ExecaReturnValue>(618expectType<ExecaReturnValue<false>>(await execaNode('unicorns'));619expectType<ExecaReturnValue<false>>(await execaNode(fileUrl));620expectType<ExecaReturnValue<false>>(621 await execaNode('unicorns', {encoding: 'utf8'}),622);411expectType<ExecaReturnValue<Uint8Array>>(await execaNode('unicorns', {encoding: 'buffer'}));412expectType<ExecaReturnValue>(623expectType<ExecaReturnValue<false, Uint8Array>>(await execaNode('unicorns', {encoding: 'buffer'}));624expectType<ExecaReturnValue<false>>(625 await execaNode('unicorns', ['foo'], {encoding: 'utf8'}),626);415expectType<ExecaReturnValue<Uint8Array>>(627expectType<ExecaReturnValue<false, Uint8Array>>(628 await execaNode('unicorns', ['foo'], {encoding: 'buffer'}),629);630631expectType<ExecaChildProcess>(execaNode('unicorns', {nodePath: './node'}));
8 unmodified lines
640 execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}),641);642643expectType<ExecaChildProcess>($`unicorns`);432expectType<ExecaReturnValue>(await $`unicorns`);433expectType<ExecaSyncReturnValue>($.sync`unicorns`);434expectType<ExecaSyncReturnValue>($.s`unicorns`);644expectType<ExecaReturnValue<false>>(await $`unicorns`);645expectType<ExecaReturnValue<true>>($.sync`unicorns`);646expectType<ExecaReturnValue<true>>($.s`unicorns`);647648expectType<ExecaChildProcess>($({encoding: 'utf8'})`unicorns`);437expectType<ExecaReturnValue>(await $({encoding: 'utf8'})`unicorns`);438expectType<ExecaSyncReturnValue>($({encoding: 'utf8'}).sync`unicorns`);649expectType<ExecaReturnValue<false>>(await $({encoding: 'utf8'})`unicorns`);650expectType<ExecaReturnValue<true>>($({encoding: 'utf8'}).sync`unicorns`);651652expectType<ExecaChildProcess>($({encoding: 'utf8'})`unicorns foo`);441expectType<ExecaReturnValue>(await $({encoding: 'utf8'})`unicorns foo`);442expectType<ExecaSyncReturnValue>($({encoding: 'utf8'}).sync`unicorns foo`);653expectType<ExecaReturnValue<false>>(await $({encoding: 'utf8'})`unicorns foo`);654expectType<ExecaReturnValue<true>>($({encoding: 'utf8'}).sync`unicorns foo`);655656expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})`unicorns`);445expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})`unicorns`);446expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'}).sync`unicorns`);657expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})`unicorns`);658expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'}).sync`unicorns`);659660expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})`unicorns foo`);449expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})`unicorns foo`);450expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'}).sync`unicorns foo`);661expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})`unicorns foo`);662expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'}).sync`unicorns foo`);663664expectType<ExecaChildProcess>($({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);453expectType<ExecaReturnValue>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);454expectType<ExecaSyncReturnValue>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns`);665expectType<ExecaReturnValue<false>>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);666expectType<ExecaReturnValue<true>>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns`);667668expectType<ExecaChildProcess>($({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);457expectType<ExecaReturnValue>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);458expectType<ExecaSyncReturnValue>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns foo`);669expectType<ExecaReturnValue<false>>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);670expectType<ExecaReturnValue<true>>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns foo`);671672expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})({})`unicorns`);461expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns`);462expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns`);673expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns`);674expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns`);675676expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})({})`unicorns foo`);465expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns foo`);466expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns foo`);677expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns foo`);678expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns foo`);679468expectType<ExecaReturnValue>(await $`unicorns ${'foo'}`);469expectType<ExecaSyncReturnValue>($.sync`unicorns ${'foo'}`);470expectType<ExecaReturnValue>(await $`unicorns ${1}`);471expectType<ExecaSyncReturnValue>($.sync`unicorns ${1}`);472expectType<ExecaReturnValue>(await $`unicorns ${['foo', 'bar']}`);473expectType<ExecaSyncReturnValue>($.sync`unicorns ${['foo', 'bar']}`);474expectType<ExecaReturnValue>(await $`unicorns ${[1, 2]}`);475expectType<ExecaSyncReturnValue>($.sync`unicorns ${[1, 2]}`);476expectType<ExecaReturnValue>(await $`unicorns ${await $`echo foo`}`);477expectError<ExecaReturnValue>(await $`unicorns ${$`echo foo`}`);478expectType<ExecaSyncReturnValue>($.sync`unicorns ${$.sync`echo foo`}`);479expectType<ExecaReturnValue>(await $`unicorns ${[await $`echo foo`, 'bar']}`);480expectError<ExecaReturnValue>(await $`unicorns ${[$`echo foo`, 'bar']}`);481expectType<ExecaSyncReturnValue>($.sync`unicorns ${[$.sync`echo foo`, 'bar']}`);482expectType<ExecaReturnValue>(await $`unicorns ${true.toString()}`);483expectType<ExecaSyncReturnValue>($.sync`unicorns ${false.toString()}`);484expectError<ExecaReturnValue>(await $`unicorns ${true}`);485expectError<ExecaSyncReturnValue>($.sync`unicorns ${false}`);680expectType<ExecaReturnValue<false>>(await $`unicorns ${'foo'}`);681expectType<ExecaReturnValue<true>>($.sync`unicorns ${'foo'}`);682expectType<ExecaReturnValue<false>>(await $`unicorns ${1}`);683expectType<ExecaReturnValue<true>>($.sync`unicorns ${1}`);684expectType<ExecaReturnValue<false>>(await $`unicorns ${['foo', 'bar']}`);685expectType<ExecaReturnValue<true>>($.sync`unicorns ${['foo', 'bar']}`);686expectType<ExecaReturnValue<false>>(await $`unicorns ${[1, 2]}`);687expectType<ExecaReturnValue<true>>($.sync`unicorns ${[1, 2]}`);688expectType<ExecaReturnValue<false>>(await $`unicorns ${await $`echo foo`}`);689expectError<ExecaReturnValue<false>>(await $`unicorns ${$`echo foo`}`);690expectType<ExecaReturnValue<true>>($.sync`unicorns ${$.sync`echo foo`}`);691expectType<ExecaReturnValue<false>>(await $`unicorns ${[await $`echo foo`, 'bar']}`);692expectError<ExecaReturnValue<false>>(await $`unicorns ${[$`echo foo`, 'bar']}`);693expectType<ExecaReturnValue<true>>($.sync`unicorns ${[$.sync`echo foo`, 'bar']}`);694expectType<ExecaReturnValue<false>>(await $`unicorns ${true.toString()}`);695expectType<ExecaReturnValue<true>>($.sync`unicorns ${false.toString()}`);696expectError<ExecaReturnValue<false>>(await $`unicorns ${true}`);697expectError<ExecaReturnValue<true>>($.sync`unicorns ${false}`);