Skip to content
Myr

Upgrade dependencies

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

authored by Sindre Sorhus · committed by Sindre Sorhus · parent bdbd975 · Browse files · 7 files+46 added−47 removed
This commit

State

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

Diff stats

7 files+46 added−47 removed

  • tests:+6 added−6 removed
  • other:+40 added−41 removed

7 files+46 added−47 removed

modified:lib/stdio.js+8 added-8 removed
modified:test/error.js+3 added-3 removed
39 unmodified lines
40 const {exitCode} = await execa('noop', ['foo']);41 t.is(exitCode, 0);42});4344const testExitCode = async (t, num) => {45 const {exitCode} = await t.throwsAsync(execa('exit', [`${num}`]), {message: getExitRegExp(num)});46 t.is(exitCode, num);44const testExitCode = async (t, number) => {45 const {exitCode} = await t.throwsAsync(execa('exit', [`${number}`]), {message: getExitRegExp(number)});46 t.is(exitCode, number);47};4849test('exitCode is 2', testExitCode, 2);50test('exitCode is 3', testExitCode, 3);
160 unmodified lines
modified:test/kill.js+1 added-1 removed
61 unmodified lines
62 });6364 test('`forceKillAfterTimeout` should not be NaN', t => {65 t.throws(() => {66 execa('noop').kill('SIGTERM', {forceKillAfterTimeout: NaN});66 execa('noop').kill('SIGTERM', {forceKillAfterTimeout: Number.NaN});67 }, {instanceOf: TypeError, message: /non-negative integer/});68 });6970 test('`forceKillAfterTimeout` should not be negative', t => {
192 unmodified lines
modified:test/stdio.js+2 added-2 removed
modified:index.d.ts+14 added-15 removed
332 unmodified lines
333 }334335 interface ExecaSyncError<StdoutErrorType = string>336 extends Error,337 ExecaReturnBase<StdoutErrorType> {337 ExecaReturnBase<StdoutErrorType> {338 /**339 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.340341 The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
41 unmodified lines
383 forceKillAfterTimeout?: number | false;384 }385386 interface ExecaChildPromise<StdoutErrorType> {387 /**388 Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).389390 This is `undefined` if either:391 - the `all` option is `false` (the default value)392 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)393 */394 all?: ReadableStream;395396 catch<ResultType = never>(397 onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>398 ): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;399400 /**401 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`.402 */394 kill(signal?: string, options?: execa.KillOptions): void;403 kill(signal?: string, options?: KillOptions): void;404405 /**406 Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.407 */408 cancel(): void;400401 /**402 Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).403404 This is `undefined` if either:405 - the `all` option is `false` (the default value)406 - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)407 */408 all?: ReadableStream;409 }410411 type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &412 ExecaChildPromise<StdoutErrorType> &413 Promise<ExecaReturnValue<StdoutErrorType>>;412 ExecaChildPromise<StdoutErrorType> &413 Promise<ExecaReturnValue<StdoutErrorType>>;414}415416declare const execa: {417 /**
13 unmodified lines
431 const {stdout} = await execa('echo', ['unicorns']);432 console.log(stdout);433 //=> 'unicorns'434435435 // Cancelling a spawned process436437 const subprocess = execa('node');438
24 unmodified lines
463 options?: execa.Options<null>464 ): execa.ExecaChildProcess<Buffer>;465 (file: string, options?: execa.Options): execa.ExecaChildProcess;466 (file: string, options?: execa.Options<null>): execa.ExecaChildProcess<468 Buffer467 Buffer468 >;469470 /**471 Execute a file synchronously.
83 unmodified lines
modified:index.test-d.ts+4 added-4 removed
1import {expectType, expectError} from 'tsd';2import {Readable as ReadableStream} from 'stream'2import {Readable as ReadableStream} from 'stream';3import execa = require('.');4import {5 ExecaReturnValue,6 ExecaChildProcess,
4 unmodified lines
1112try {13 const execaPromise = execa('unicorns');14 execaPromise.cancel();15 expectType<ReadableStream | undefined>(execaPromise.all)15 expectType<ReadableStream | undefined>(execaPromise.all);1617 const unicornsResult = await execaPromise;18 expectType<string>(unicornsResult.command);19 expectType<number>(unicornsResult.exitCode);
5 unmodified lines
25 expectType<boolean>(unicornsResult.isCanceled);26 expectType<boolean>(unicornsResult.killed);27 expectType<string | undefined>(unicornsResult.signal);28 expectType<string | undefined>(unicornsResult.signalDescription);29} catch (error) {29} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch30 const execaError: ExecaError = error;3132 expectType<string>(execaError.message);33 expectType<number>(execaError.exitCode);
22 unmodified lines
56 expectError(unicornsResult.isCanceled);57 expectType<boolean>(unicornsResult.killed);58 expectType<string | undefined>(unicornsResult.signal);59 expectType<string | undefined>(unicornsResult.signalDescription);60} catch (error) {60} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch61 const execaError: ExecaSyncError = error;6263 expectType<string>(execaError.message);64 expectType<number>(execaError.exitCode);
127 unmodified lines
modified:package.json+14 added-14 removed