Skip to content
Myr

Improve tests for the `timeout` option (#332)

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 2a7551f · Browse files · 1 file+8 added−3 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−3 removed

  • tests:+8 added−3 removed

1 file+8 added−3 removed

modified:test/kill.js+8 added-3 removed
78 unmodified lines
79 t.is(typeof kill, 'function');80});8182test('timeout kills the process if it times out', async t => {83 const {killed, timedOut} = await t.throwsAsync(execa('forever', {timeout: 1, message: TIMEOUT_REGEXP}));83 const {killed, timedOut} = await t.throwsAsync(execa('forever', {timeout: 1}), TIMEOUT_REGEXP);84 t.false(killed);85 t.true(timedOut);86});87
23 unmodified lines
111 execa('noop', {timeout: false});112 }, INVALID_TIMEOUT_REGEXP);113});114115test('timedOut is false if no timeout was set', async t => {115test('timedOut is false if timeout is undefined', async t => {116 const {timedOut} = await execa('noop');117 t.false(timedOut);118});119120test('timedOut will be false if no timeout was set and zero exit code in sync mode', t => {120test('timedOut is false if timeout is 0', async t => {121 const {timedOut} = await execa('noop', {timeout: 0});122 t.false(timedOut);123});124125test('timedOut is false if timeout is undefined and exit code is 0 in sync mode', t => {126 const {timedOut} = execa.sync('noop');127 t.false(timedOut);128});129
133 unmodified lines