Skip to content
Myr

Fix tests (#89)

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

authored by Sam Verschueren · committed by Sindre Sorhus · parent 9cd5e2a · Browse files · 1 file+10 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+10 added−9 removed

  • other:+10 added−9 removed

1 file+10 added−9 removed

modified:test.js+10 added-9 removed
181 unmodified lines
182 t.is(typeof promise.kill, 'function');183 t.is(typeof promise.pid, 'number');184});185186test('maxBuffer affects stdout', t => {187 t.throws(m('max-buffer', ['stdout', '11'], {maxBuffer: 10}), /stdout maxBuffer exceeded/);188 t.notThrows(m('max-buffer', ['stdout', '10'], {maxBuffer: 10}));186test('maxBuffer affects stdout', async t => {187 await t.throws(m('max-buffer', ['stdout', '11'], {maxBuffer: 10}), /stdout maxBuffer exceeded/);188 await t.notThrows(m('max-buffer', ['stdout', '10'], {maxBuffer: 10}));189});190191test('maxBuffer affects stderr', t => {192 t.throws(m('max-buffer', ['stderr', '13'], {maxBuffer: 12}), /stderr maxBuffer exceeded/);193 t.notThrows(m('max-buffer', ['stderr', '12'], {maxBuffer: 12}));191test('maxBuffer affects stderr', async t => {192 await t.throws(m('max-buffer', ['stderr', '13'], {maxBuffer: 12}), /stderr maxBuffer exceeded/);193 await t.notThrows(m('max-buffer', ['stderr', '12'], {maxBuffer: 12}));194});195196test('skip throwing when using reject option', async t => {197 const err = await t.notThrows(m('exit', ['2'], {reject: false}));197 const err = await m('exit', ['2'], {reject: false});198 t.is(typeof err.stdout, 'string');199 t.is(typeof err.stderr, 'string');200});201
12 unmodified lines
214 t.is(stdout, 'foo');215});216217if (process.platform !== 'win32') {218 test('execa() rejects if running non-executable', t => {218 test('execa() rejects if running non-executable', async t => {219 const cp = m('non-executable');220 t.throws(cp);220 await t.throws(cp);221 });222}223224test('err.killed is true if process was killed directly', async t => {
180 unmodified lines
405 // Try-catch here is necessary, because this test is not 100% accurate406 // Sometimes process can manage to accept input before exiting407 try {408 await m(`fast-exit-${process.platform}`, [], {input: 'data'});409 t.pass();410 } catch (err) {411 t.is(err.code, 'EPIPE');412 }413 });
1 unmodified line