Skip to content
Myr

Fix randomly failing tests for `spawned.kill()` (#613)

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

authored by ehmicky · committed by GitHub · parent d37a0f6 · Browse files · 1 file+7 added−7 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+7 added−7 removed

  • tests:+7 added−7 removed

1 file+7 added−7 removed

modified:test/error.js+7 added-7 removed
90 unmodified lines
91 t.true(failed);92});9394test('error.killed is true if process was killed directly', async t => {95 const subprocess = execa('noop.js');95 const subprocess = execa('forever.js');9697 subprocess.kill();9899 const {killed} = await t.throwsAsync(subprocess, {message: /was killed with SIGTERM/});100 t.true(killed);101});102103test('error.killed is false if process was killed indirectly', async t => {104 const subprocess = execa('noop.js');104 const subprocess = execa('forever.js');105106 process.kill(subprocess.pid, 'SIGINT');107108 // `process.kill()` is emulated by Node.js on Windows
25 unmodified lines
134});135136if (process.platform === 'darwin') {137 test('sanity check: child_process.exec also has killed.false if killed indirectly', async t => {138 const promise = pExec('noop.js');138 const promise = pExec('forever.js');139140 process.kill(promise.child.pid, 'SIGINT');141142 const error = await t.throwsAsync(promise);
3 unmodified lines
146}147148if (process.platform !== 'win32') {149 test('error.signal is SIGINT', async t => {150 const subprocess = execa('noop.js');150 const subprocess = execa('forever.js');151152 process.kill(subprocess.pid, 'SIGINT');153154 const {signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});155 t.is(signal, 'SIGINT');156 });157158 test('error.signalDescription is defined', async t => {159 const subprocess = execa('noop.js');159 const subprocess = execa('forever.js');160161 process.kill(subprocess.pid, 'SIGINT');162163 const {signalDescription} = await t.throwsAsync(subprocess, {message: /User interruption with CTRL-C/});164 t.is(signalDescription, 'User interruption with CTRL-C');165 });166167 test('error.signal is SIGTERM', async t => {168 const subprocess = execa('noop.js');168 const subprocess = execa('forever.js');169170 process.kill(subprocess.pid, 'SIGTERM');171172 const {signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGTERM/});
5 unmodified lines
178 t.is(signal, 'SIGHUP');179 });180181 test('exitCode is undefined on signal termination', async t => {182 const subprocess = execa('noop.js');182 const subprocess = execa('forever.js');183184 process.kill(subprocess.pid);185186 const {exitCode} = await t.throwsAsync(subprocess);
39 unmodified lines