From 8ed4dea58821e0efe4c040426887e03f400e16cc Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 20 Mar 2019 20:49:39 +0530 Subject: [PATCH] Rename .cmd to .command --- index.d.ts | 6 +++--- index.js | 6 +++--- index.test-d.ts | 4 ++-- readme.md | 4 ++-- test.js | 14 +++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6f2a7b6f3b..b69bd7799c 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. @@ -421,7 +421,7 @@ declare const execa: { // stderr: '', // all: '', // failed: true, - // cmd: 'exit 3', + // command: 'exit 3', // timedOut: false, // killed: false //} @@ -478,7 +478,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 3266a0771c..81d0c80227 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 3e6eb23e07..12d63e9837 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 53eb19ce54..46b5b246b8 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 6dfb7430b1..eba24b6a1b 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';