(actual, expected)
| 673 | } |
| 674 | |
| 675 | function hasMatchingError(actual, expected) { |
| 676 | if (typeof expected !== 'function') { |
| 677 | if (isRegExp(expected)) { |
| 678 | const str = String(actual); |
| 679 | return RegExpPrototypeExec(expected, str) !== null; |
| 680 | } |
| 681 | throw new ERR_INVALID_ARG_TYPE( |
| 682 | 'expected', ['Function', 'RegExp'], expected, |
| 683 | ); |
| 684 | } |
| 685 | // Guard instanceof against arrow functions as they don't have a prototype. |
| 686 | if (expected.prototype !== undefined && actual instanceof expected) { |
| 687 | return true; |
| 688 | } |
| 689 | if (ObjectPrototypeIsPrototypeOf(Error, expected)) { |
| 690 | return false; |
| 691 | } |
| 692 | return FunctionPrototypeCall(expected, {}, actual) === true; |
| 693 | } |
| 694 | |
| 695 | function expectsNoError(stackStartFn, actual, error, message) { |
| 696 | if (actual === NO_EXCEPTION_SENTINEL) |
no test coverage detected
searching dependent graphs…