(validator, exact)
| 729 | |
| 730 | // Useful for testing expected internal/error objects |
| 731 | function expectsError(validator, exact) { |
| 732 | return mustCall((...args) => { |
| 733 | if (args.length !== 1) { |
| 734 | // Do not use `assert.strictEqual()` to prevent `inspect` from |
| 735 | // always being called. |
| 736 | assert.fail(`Expected one argument, got ${inspect(args)}`); |
| 737 | } |
| 738 | const error = args.pop(); |
| 739 | // The error message should be non-enumerable |
| 740 | assert.strictEqual(Object.prototype.propertyIsEnumerable.call(error, 'message'), false); |
| 741 | |
| 742 | assert.throws(() => { throw error; }, validator); |
| 743 | return true; |
| 744 | }, exact); |
| 745 | } |
| 746 | |
| 747 | function skipIfInspectorDisabled() { |
| 748 | if (!hasInspector) { |
no test coverage detected
searching dependent graphs…