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
Provenance
- Commit
5d64878- Tree
83612e8- Author
Sindre Sorhus <sindresorhus@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
bdbd975
7 files changed+46 added−47 removed
modified:lib/stdio.js+8 added-8 removed
12344567678910111112131414151617171819202110 unmodified lines32333435363736373839404111 unmodified lines'use strict';const aliases = ['stdin', 'stdout', 'stderr'];
const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined);const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
const normalizeStdio = opts => { if (!opts) {const normalizeStdio = options => { if (!options) { return; }
const {stdio} = opts; const {stdio} = options;
if (stdio === undefined) { return aliases.map(alias => opts[alias]); return aliases.map(alias => options[alias]); }
if (hasAlias(opts)) { if (hasAlias(options)) { throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`); }
if (typeof stdio === 'string') {10 unmodified lines
module.exports = normalizeStdio;
// `ipc` is pushed unless it is already presentmodule.exports.node = opts => { const stdio = normalizeStdio(opts);module.exports.node = options => { const stdio = normalizeStdio(options);
if (stdio === 'ipc') { return 'ipc'; }11 unmodified linesmodified:test/error.js+3 added-3 removed
39 unmodified lines40 const {exitCode} = await execa('noop', ['foo']);41 t.is(exitCode, 0);42 });43 44-const testExitCode = async (t, num) => {45- const {exitCode} = await t.throwsAsync(execa('exit', [`${num}`]), {message: getExitRegExp(num)});46- t.is(exitCode, num);44+const testExitCode = async (t, number) => {45+ const {exitCode} = await t.throwsAsync(execa('exit', [`${number}`]), {message: getExitRegExp(number)});46+ t.is(exitCode, number);47 };48 49 test('exitCode is 2', testExitCode, 2);50 test('exitCode is 3', testExitCode, 3);160 unmodified linesmodified:test/kill.js+1 added-1 removed
61 unmodified lines62 });63 64 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 });69 70 test('`forceKillAfterTimeout` should not be negative', t => {192 unmodified linesmodified:test/stdio.js+2 added-2 removed
1123456 unmodified lines1213141516161718192046 unmodified linesimport util from 'util';import {inspect} from 'util';import test from 'ava';import normalizeStdio from '../lib/stdio';
const macro = (t, input, expected, func) => {6 unmodified lines
t.deepEqual(func(input), expected);};
const macroTitle = name => (title, input) => `${name} ${(util.inspect(input))}`;const macroTitle = name => (title, input) => `${name} ${(inspect(input))}`;
const stdioMacro = (...args) => macro(...args, normalizeStdio);stdioMacro.title = macroTitle('execa()');
46 unmodified linesmodified:index.d.ts+14 added-15 removed
332 unmodified lines333 }334 335 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.340 341 The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.41 unmodified lines383 forceKillAfterTimeout?: number | false;384 }385 386 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).389+390+ 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;395+396 catch<ResultType = never>(397 onRejected?: (reason: ExecaError<StdoutErrorType>) => ResultType | PromiseLike<ResultType>398 ): Promise<ExecaReturnValue<StdoutErrorType> | ResultType>;399 400 /**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;404 405 /**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;400-401- /**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).403-404- 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 }410 411 type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &412- ExecaChildPromise<StdoutErrorType> &413- Promise<ExecaReturnValue<StdoutErrorType>>;412+ ExecaChildPromise<StdoutErrorType> &413+ Promise<ExecaReturnValue<StdoutErrorType>>;414 }415 416 declare const execa: {417 /**13 unmodified lines431 const {stdout} = await execa('echo', ['unicorns']);432 console.log(stdout);433 //=> 'unicorns'434 435-435 // Cancelling a spawned process436 437 const subprocess = execa('node');438 24 unmodified lines463 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 >;469 470 /**471 Execute a file synchronously.83 unmodified linesmodified:index.test-d.ts+4 added-4 removed
1 import {expectType, expectError} from 'tsd';2-import {Readable as ReadableStream} from 'stream'2+import {Readable as ReadableStream} from 'stream';3 import execa = require('.');4 import {5 ExecaReturnValue,6 ExecaChildProcess,4 unmodified lines11 12 try {13 const execaPromise = execa('unicorns');14 execaPromise.cancel();15- expectType<ReadableStream | undefined>(execaPromise.all)15+ expectType<ReadableStream | undefined>(execaPromise.all);16 17 const unicornsResult = await execaPromise;18 expectType<string>(unicornsResult.command);19 expectType<number>(unicornsResult.exitCode);5 unmodified lines25 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;31 32 expectType<string>(execaError.message);33 expectType<number>(execaError.exitCode);22 unmodified lines56 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;62 63 expectType<string>(execaError.message);64 expectType<number>(execaError.exitCode);127 unmodified linesmodified:package.json+14 added-14 removed
37 unmodified lines383940414243444243444546474849474849505152535455565354555657585958596061626162636465665 unmodified lines37 unmodified lines "path", "local" ], "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", "human-signals": "^1.1.1", "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.0", "onetime": "^5.1.0", "signal-exit": "^3.0.2", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" }, "devDependencies": { "@types/node": "^12.12.18", "ava": "^2.1.0", "coveralls": "^3.0.9", "get-node": "^6.6.0", "@types/node": "^14.14.10", "ava": "^2.4.0", "coveralls": "^3.1.0", "get-node": "^11.0.1", "is-running": "^2.1.0", "nyc": "^14.1.1", "p-event": "^4.1.0", "nyc": "^15.1.0", "p-event": "^4.2.0", "tempfile": "^3.0.0", "tsd": "^0.11.0", "xo": "^0.25.3" "tsd": "^0.13.1", "xo": "^0.35.0" }, "nyc": { "exclude": [ "**/fixtures/**",5 unmodified lines