(t, pipePromise, unhandledRejectionPromise)
| 15 | const timeoutSymbol = Symbol('timeout'); |
| 16 | |
| 17 | const assertUnhandledRejection = async (t, pipePromise, unhandledRejectionPromise) => { |
| 18 | const result = await Promise.race([ |
| 19 | unhandledRejectionPromise, |
| 20 | setTimeout(500, timeoutSymbol), |
| 21 | ]); |
| 22 | |
| 23 | t.not(result, timeoutSymbol); |
| 24 | |
| 25 | if (result === timeoutSymbol) { |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | const [reason, unhandledPromise] = result; |
| 30 | t.is(unhandledPromise, pipePromise); |
| 31 | t.regex(reason.message, /Command failed with exit code 2/); |
| 32 | }; |
| 33 | |
| 34 | const assertUnhandledPipePromise = async (t, {destinationOptions = {}, inspectPipePromise} = {}) => { |
| 35 | const source = execa('fail.js'); |
no outgoing calls
no test coverage detected