Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename .cmd to .command #194

Merged
merged 1 commit into from Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.d.ts
Expand Up @@ -221,7 +221,7 @@ export interface ExecaReturnBase<StdoutStderrType> {
/**
The command that was run.
*/
cmd: string;
command: string;

/**
Whether the process timed out.
Expand Down Expand Up @@ -421,7 +421,7 @@ declare const execa: {
// stderr: '',
// all: '',
// failed: true,
// cmd: 'exit 3',
// command: 'exit 3',
// timedOut: false,
// killed: false
//}
Expand Down Expand Up @@ -478,7 +478,7 @@ declare const execa: {
// stdout: '',
// stderr: '',
// failed: true,
// cmd: 'exit 3',
// command: 'exit 3',
// timedOut: false
//}
}
Expand Down
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -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;

Expand Down Expand Up @@ -341,7 +341,7 @@ const execa = (command, args, options) => {
exitCodeName: 'SUCCESS',
failed: false,
killed: false,
cmd: joinedCommand,
command: joinedCommand,
timedOut: false,
isCanceled: false
};
Expand Down Expand Up @@ -422,7 +422,7 @@ module.exports.sync = (command, args, options) => {
exitCode: 0,
exitCodeName: 'SUCCESS',
failed: false,
cmd: joinedCommand,
command: joinedCommand,
timedOut: false
};
};
Expand Down
4 changes: 2 additions & 2 deletions index.test-d.ts
Expand Up @@ -12,7 +12,7 @@ try {
execaPromise.cancel();

const unicornsResult = await execaPromise;
expectType<string>(unicornsResult.cmd);
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.killed);
Expand All @@ -33,7 +33,7 @@ try {

try {
const unicornsResult = execa.sync('unicorns');
expectType<string>(unicornsResult.cmd);
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.killed);
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Expand Up @@ -67,7 +67,7 @@ const execa = require('execa');
stderr: '',
all: '',
failed: true,
cmd: 'exit 3',
command: 'exit 3',
timedOut: false,
killed: false
}
Expand Down Expand Up @@ -101,7 +101,7 @@ try {
stdout: '',
stderr: '',
failed: true,
cmd: 'exit 3',
command: 'exit 3',
timedOut: false
}
*/
Expand Down
14 changes: 7 additions & 7 deletions test.js
Expand Up @@ -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';
Expand Down