* @class Assert * @param {AssertOptions} [options] - Optional configuration for assertions. * @throws {ERR_CONSTRUCT_CALL_REQUIRED} If not called with `new`.
(options)
| 103 | * @throws {ERR_CONSTRUCT_CALL_REQUIRED} If not called with `new`. |
| 104 | */ |
| 105 | function Assert(options) { |
| 106 | if (!new.target) { |
| 107 | throw new ERR_CONSTRUCT_CALL_REQUIRED('Assert'); |
| 108 | } |
| 109 | |
| 110 | options = ObjectAssign({ __proto__: null, strict: true, skipPrototype: false }, options); |
| 111 | |
| 112 | const allowedDiffs = ['simple', 'full']; |
| 113 | if (options.diff !== undefined) { |
| 114 | validateOneOf(options.diff, 'options.diff', allowedDiffs); |
| 115 | } |
| 116 | |
| 117 | this.AssertionError = AssertionError; |
| 118 | ObjectDefineProperty(this, kOptions, { |
| 119 | __proto__: null, |
| 120 | value: options, |
| 121 | enumerable: false, |
| 122 | configurable: false, |
| 123 | writable: false, |
| 124 | }); |
| 125 | |
| 126 | if (options.strict) { |
| 127 | this.equal = this.strictEqual; |
| 128 | this.deepEqual = this.deepStrictEqual; |
| 129 | this.notEqual = this.notStrictEqual; |
| 130 | this.notDeepEqual = this.notDeepStrictEqual; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // All of the following functions must throw an AssertionError |
| 135 | // when a corresponding condition is not met, with a message that |
no test coverage detected
searching dependent graphs…