Skip to content

Commit

Permalink
Fix TypeScript tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 14, 2019
1 parent 27d7b1e commit 0798910
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ try {
const unicornsResult = await execaPromise;
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<string>(unicornsResult.stderr);
expectType<number>(unicornsResult.exitCode);
expectType<string>(unicornsResult.exitCodeName);
expectType<string>(unicornsResult.stdout);
expectType<string>(unicornsResult.stderr);
expectType<string>(unicornsResult.all);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.timedOut);
Expand All @@ -28,16 +30,26 @@ try {

expectType<string>(execaError.message);
expectType<number | string>(execaError.code);
expectType<number>(execaError.exitCode);
expectType<string>(execaError.exitCodeName);
expectType<string>(execaError.stdout);
expectType<string>(execaError.stderr);
expectType<string>(execaError.all);
expectType<boolean>(execaError.failed);
expectType<boolean>(execaError.timedOut);
expectType<boolean>(execaError.isCanceled);
expectType<boolean>(execaError.killed);
expectType<string | undefined>(execaError.signal);
}

try {
const unicornsResult = execa.sync('unicorns');
expectType<string>(unicornsResult.command);
expectType<string | number>(unicornsResult.code);
expectType<string>(unicornsResult.stderr);
expectType<number>(unicornsResult.exitCode);
expectType<string>(unicornsResult.exitCodeName);
expectType<string>(unicornsResult.stdout);
expectType<string>(unicornsResult.stderr);
expectError(unicornsResult.all);
expectType<boolean>(unicornsResult.failed);
expectType<boolean>(unicornsResult.timedOut);
Expand All @@ -49,8 +61,16 @@ try {

expectType<string>(execaError.message);
expectType<number | string>(execaError.code);
expectType<number>(execaError.exitCode);
expectType<string>(execaError.exitCodeName);
expectType<string>(execaError.stdout);
expectType<string>(execaError.stderr);
expectError(execaError.all);
expectType<boolean>(execaError.failed);
expectType<boolean>(execaError.timedOut);
expectError(execaError.isCanceled);
expectType<boolean>(execaError.killed);
expectType<string | undefined>(execaError.signal);
}

execa('unicorns', {cwd: '.'});
Expand Down Expand Up @@ -85,21 +105,24 @@ execa('unicorns', {stdin: 'inherit'});
execa('unicorns', {stdin: process.stdin});
execa('unicorns', {stdin: 1});
execa('unicorns', {stdin: undefined});
execa('unicorns', {stderr: 'pipe'});
execa('unicorns', {stderr: 'ipc'});
execa('unicorns', {stderr: 'ignore'});
execa('unicorns', {stderr: 'inherit'});
execa('unicorns', {stderr: process.stderr});
execa('unicorns', {stderr: 1});
execa('unicorns', {stderr: undefined});
execa('unicorns', {stdout: 'pipe'});
execa('unicorns', {stdout: 'ipc'});
execa('unicorns', {stdout: 'ignore'});
execa('unicorns', {stdout: 'inherit'});
execa('unicorns', {stdout: process.stdout});
execa('unicorns', {stdout: 1});
execa('unicorns', {stdout: undefined});
execa('unicorns', {stderr: 'pipe'});
execa('unicorns', {stderr: 'ipc'});
execa('unicorns', {stderr: 'ignore'});
execa('unicorns', {stderr: 'inherit'});
execa('unicorns', {stderr: process.stderr});
execa('unicorns', {stderr: 1});
execa('unicorns', {stderr: undefined});
execa('unicorns', {windowsVerbatimArguments: true});
execa('unicorns', {input: ''});
execa('unicorns', {input: Buffer.from('')});
execa('unicorns', {input: process.stdin});

expectType<ExecaChildProcess<string>>(execa('unicorns'));
expectType<ExecaReturnValue<string>>(await execa('unicorns'));
Expand Down

0 comments on commit 0798910

Please sign in to comment.