diff --git a/index.d.ts b/index.d.ts index afb0175a2..efab5e5e5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -221,7 +221,7 @@ export interface ExecaReturnBase { /** The command that was run. */ - cmd: string; + command: string; /** Whether the process timed out. @@ -419,7 +419,7 @@ declare const execa: { // stderr: '', // all: '', // failed: true, - // cmd: 'exit 3', + // command: 'exit 3', // timedOut: false, // killed: false //} @@ -476,7 +476,7 @@ declare const execa: { // stdout: '', // stderr: '', // failed: true, - // cmd: 'exit 3', + // command: 'exit 3', // timedOut: false //} } diff --git a/index.js b/index.js index 3266a0771..81d0c8022 100644 --- a/index.js +++ b/index.js @@ -164,7 +164,7 @@ function makeError(result, options) { // `signal` emitted on `spawned.on('exit')` event can be `null`. We normalize // it to `undefined` error.signal = signal || undefined; - error.cmd = joinedCommand; + error.command = joinedCommand; error.timedOut = Boolean(timedOut); error.isCanceled = isCanceled; @@ -341,7 +341,7 @@ const execa = (command, args, options) => { exitCodeName: 'SUCCESS', failed: false, killed: false, - cmd: joinedCommand, + command: joinedCommand, timedOut: false, isCanceled: false }; @@ -422,7 +422,7 @@ module.exports.sync = (command, args, options) => { exitCode: 0, exitCodeName: 'SUCCESS', failed: false, - cmd: joinedCommand, + command: joinedCommand, timedOut: false }; }; diff --git a/index.test-d.ts b/index.test-d.ts index 3e6eb23e0..12d63e983 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -12,7 +12,7 @@ try { execaPromise.cancel(); const unicornsResult = await execaPromise; - expectType(unicornsResult.cmd); + expectType(unicornsResult.command); expectType(unicornsResult.code); expectType(unicornsResult.failed); expectType(unicornsResult.killed); @@ -33,7 +33,7 @@ try { try { const unicornsResult = execa.sync('unicorns'); - expectType(unicornsResult.cmd); + expectType(unicornsResult.command); expectType(unicornsResult.code); expectType(unicornsResult.failed); expectType(unicornsResult.killed); diff --git a/readme.md b/readme.md index 53eb19ce5..46b5b246b 100644 --- a/readme.md +++ b/readme.md @@ -67,7 +67,7 @@ const execa = require('execa'); stderr: '', all: '', failed: true, - cmd: 'exit 3', + command: 'exit 3', timedOut: false, killed: false } @@ -101,7 +101,7 @@ try { stdout: '', stderr: '', failed: true, - cmd: 'exit 3', + command: 'exit 3', timedOut: false } */ diff --git a/test.js b/test.js index 6dfb7430b..eba24b6a1 100644 --- a/test.js +++ b/test.js @@ -416,19 +416,19 @@ errorMessage.title = (message, expected) => `error.message matches: ${expected}` test(errorMessage, /Command failed with exit code 2.*: exit 2 foo bar/, 2, 'foo', 'bar'); test(errorMessage, /Command failed with exit code 3.*: exit 3 baz quz/, 3, 'baz', 'quz'); -async function cmd(t, expected, ...args) { +async function command(t, expected, ...args) { const error = await t.throwsAsync(execa('fail', args)); - t.is(error.cmd, `fail${expected}`); + t.is(error.command, `fail${expected}`); const result = await execa('noop', args); - t.is(result.cmd, `noop${expected}`); + t.is(result.command, `noop${expected}`); } -cmd.title = (message, expected) => `cmd is: ${JSON.stringify(expected)}`; +command.title = (message, expected) => `command is: ${JSON.stringify(expected)}`; -test(cmd, ' foo bar', 'foo', 'bar'); -test(cmd, ' baz quz', 'baz', 'quz'); -test(cmd, ''); +test(command, ' foo bar', 'foo', 'bar'); +test(command, ' baz quz', 'baz', 'quz'); +test(command, ''); async function spawnAndKill(t, signal, cleanup) { const name = cleanup ? 'sub-process' : 'sub-process-false';