Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 10, 2019
1 parent 7c8563e commit 751c8a9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test.js
Expand Up @@ -65,25 +65,23 @@ test('stdout/stderr/all are undefined if ignored in sync mode', t => {
t.is(all, undefined);
});

const WRONG_COMMAND = process.platform === 'win32' ?
'\'wrong\' is not recognized as an internal or external command,\r\noperable program or batch file.' :
'';

test('stdout/stderr/all on process errors', async t => {
const {stdout, stderr, all} = await t.throwsAsync(execa('wrong command'));
t.is(stdout, '');
t.is(stderr, process.platform === 'win32' ?
'\'wrong\' is not recognized as an internal or external command,\r\noperable program or batch file.' :
'');
t.is(all, process.platform === 'win32' ?
'\'wrong\' is not recognized as an internal or external command,\r\noperable program or batch file.' :
'');
t.is(stderr, WRONG_COMMAND);
t.is(all, WRONG_COMMAND);
});

test('stdout/stderr/all on process errors, in sync mode', t => {
const {stdout, stderr, all} = t.throws(() => {
execa.sync('wrong command');
});
t.is(stdout, '');
t.is(stderr, process.platform === 'win32' ?
'\'wrong\' is not recognized as an internal or external command,\r\noperable program or batch file.' :
'');
t.is(stderr, WRONG_COMMAND);
t.is(all, undefined);
});

Expand Down

0 comments on commit 751c8a9

Please sign in to comment.