(promiseFn)
| 595 | } |
| 596 | |
| 597 | async function waitForActual(promiseFn) { |
| 598 | let resultPromise; |
| 599 | if (typeof promiseFn === 'function') { |
| 600 | // Return a rejected promise if `promiseFn` throws synchronously. |
| 601 | resultPromise = promiseFn(); |
| 602 | // Fail in case no promise is returned. |
| 603 | if (!checkIsPromise(resultPromise)) { |
| 604 | throw new ERR_INVALID_RETURN_VALUE('instance of Promise', |
| 605 | 'promiseFn', resultPromise); |
| 606 | } |
| 607 | } else if (checkIsPromise(promiseFn)) { |
| 608 | resultPromise = promiseFn; |
| 609 | } else { |
| 610 | throw new ERR_INVALID_ARG_TYPE( |
| 611 | 'promiseFn', ['Function', 'Promise'], promiseFn); |
| 612 | } |
| 613 | |
| 614 | try { |
| 615 | await resultPromise; |
| 616 | } catch (e) { |
| 617 | return e; |
| 618 | } |
| 619 | return NO_EXCEPTION_SENTINEL; |
| 620 | } |
| 621 | |
| 622 | function expectsError(stackStartFn, actual, error, message) { |
| 623 | if (typeof error === 'string') { |
no test coverage detected
searching dependent graphs…