Skip to content

Commit

Permalink
Fix tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 30, 2019
1 parent 6ee53df commit 0bd1f2c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test.js
Expand Up @@ -65,23 +65,21 @@ test('stdout/stderr/all are undefined if ignored in sync mode', t => {
t.is(all, undefined);
});

const WRONG_COMMAND_STDERR = 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, WRONG_COMMAND_STDERR);
t.is(all, WRONG_COMMAND_STDERR);
t.is(stderr, '');
t.is(all, '');
});

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, WRONG_COMMAND_STDERR);
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, undefined);
});

Expand Down

0 comments on commit 0bd1f2c

Please sign in to comment.