Skip to content
Myr

Improve tests for the `reject` option (#233)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by Sindre Sorhus · parent 3973fd4 · Browse files · 1 file+8 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−9 removed

  • other:+8 added−9 removed

1 file+8 added−9 removed

modified:test.js+8 added-9 removed
108 unmodified lines
109 execa.sync('foo');110 }, process.platform === 'win32' ? /failed with exit code 1/ : /spawnSync foo ENOENT/);111});112113test('skip throwing when using reject option in execa.sync()', t => {114 const error = execa.sync('noop-err', ['foo'], {reject: false});115 t.is(error.stderr, 'foo');113test('skip throwing when using reject option', async t => {114 const error = await execa('fail', {reject: false});115 t.is(error.exitCode, 2);116});117118test('skip throwing when using reject option in sync mode', t => {119 const error = execa.sync('fail', {reject: false});120 t.is(error.exitCode, 2);121});122123test('stripEof option (legacy)', async t => {124 const {stdout} = await execa('noop', ['foo'], {stripEof: false});125 t.is(stdout, 'foo\n');126});
108 unmodified lines
235 t.is(result.stderr, undefined);236 t.is(stderr, '.........\n');237});238234test('skip throwing when using reject option', async t => {235 const error = await execa('exit', ['2'], {reject: false});236 t.is(typeof error.stdout, 'string');237 t.is(typeof error.stderr, 'string');238});239239test('allow unknown exit code', async t => {240 const {exitCode, exitCodeName} = await t.throwsAsync(execa('exit', ['255']), {message: /exit code 255 \(Unknown system error -255\)/});241 t.is(exitCode, 255);242 t.is(exitCodeName, 'Unknown system error -255');
404 unmodified lines