Skip to content
Myr

Refactor `timeout` option to use `async/await` (#650)

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

authored by ehmicky · committed by GitHub · parent 813e2c6 · Browse files · 2 files+19 added−25 removed
This commit

State

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

Diff stats

2 files+19 added−25 removed

  • tests:+4 added−9 removed
  • other:+15 added−16 removed

2 files+19 added−25 removed

modified:lib/kill.js+15 added-16 removed
modified:test/kill.js+4 added-9 removed
182 unmodified lines
183184// See #128185test('removes exit handler on exit', async t => {186 // @todo this relies on `signal-exit` internals187 const emitter = globalThis[Symbol.for('signal-exit emitter')];187 const exitListeners = globalThis[Symbol.for('signal-exit emitter')].listeners.exit;188189 const subprocess = execa('noop.js');190 const listener = emitter.listeners.exit.at(-1);190 const listener = exitListeners.at(-1);191192 await new Promise((resolve, reject) => {193 subprocess.on('error', reject);194 subprocess.on('exit', resolve);195 });196197 const included = emitter.listeners.exit.includes(listener);198 t.false(included);192 await subprocess;193 t.false(exitListeners.includes(listener));194});195196test('cancel method kills the subprocess', async t => {197 const subprocess = execa('node');
117 unmodified lines