Skip to content
Myr

Fix `error.originalMessage` (#991)

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

authored by ehmicky · committed by GitHub · parent f092dec · Browse files · 5 files+9 added−8 removed
This commit

State

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

Diff stats

5 files+9 added−8 removed

  • tests:+4 added−4 removed
  • other:+5 added−4 removed

5 files+9 added−8 removed

modified:lib/return/message.js+5 added-4 removed
modified:test/resolve/exit.js+1 added-1 removed
modified:test/return/final-error.js+1 added-1 removed
13 unmodified lines
14const testUnusualError = async (t, error, expectedOriginalMessage = String(error)) => {15 const subprocess = execa('empty.js');16 subprocess.emit('error', error);17 const {originalMessage, shortMessage, message} = await t.throwsAsync(subprocess);18 t.is(originalMessage, expectedOriginalMessage);18 t.is(originalMessage, expectedOriginalMessage === '' ? undefined : expectedOriginalMessage);19 t.true(shortMessage.includes(expectedOriginalMessage));20 t.is(message, shortMessage);21};22
141 unmodified lines
modified:test/return/result.js+1 added-1 removed
80 unmodified lines
8182 const {isTerminated, signal, originalMessage, message, shortMessage} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});83 t.true(isTerminated);84 t.is(signal, 'SIGINT');85 t.is(originalMessage, '');85 t.is(originalMessage, undefined);86 t.is(shortMessage, 'Command was killed with SIGINT (User interruption with CTRL-C): forever.js');87 t.is(message, shortMessage);88});89
56 unmodified lines
modified:test/terminate/timeout.js+1 added-1 removed
7 unmodified lines
8 const {isTerminated, signal, timedOut, originalMessage, shortMessage, message} = await t.throwsAsync(execa('forever.js', {timeout: 1}));9 t.true(isTerminated);10 t.is(signal, 'SIGTERM');11 t.true(timedOut);12 t.is(originalMessage, '');12 t.is(originalMessage, undefined);13 t.is(shortMessage, 'Command timed out after 1 milliseconds: forever.js');14 t.is(message, shortMessage);15});16
60 unmodified lines