(err)
| 1118 | } |
| 1119 | |
| 1120 | fail(err) { |
| 1121 | if (this.error !== null) { |
| 1122 | return; |
| 1123 | } |
| 1124 | |
| 1125 | if (this.expectFailure) { |
| 1126 | if (typeof this.expectFailure === 'object' && |
| 1127 | this.expectFailure.match !== undefined) { |
| 1128 | const { match: validation } = this.expectFailure; |
| 1129 | try { |
| 1130 | const errorToCheck = ( |
| 1131 | err?.code === 'ERR_TEST_FAILURE' && |
| 1132 | err?.failureType === kTestCodeFailure && |
| 1133 | err.cause |
| 1134 | ) ? |
| 1135 | err.cause : |
| 1136 | err; |
| 1137 | // eslint-disable-next-line no-restricted-syntax |
| 1138 | assert.throws(() => { throw errorToCheck; }, validation); |
| 1139 | } catch (e) { |
| 1140 | this.passed = false; |
| 1141 | this.error = new ERR_TEST_FAILURE( |
| 1142 | 'The test failed, but the error did not match the expected validation', |
| 1143 | kTestCodeFailure, |
| 1144 | ); |
| 1145 | this.error.cause = e; |
| 1146 | return; |
| 1147 | } |
| 1148 | } |
| 1149 | this.passed = true; |
| 1150 | } else { |
| 1151 | this.passed = false; |
| 1152 | } |
| 1153 | |
| 1154 | this.error = err; |
| 1155 | } |
| 1156 | |
| 1157 | pass() { |
| 1158 | if (this.error == null && this.expectFailure && !this.skipped) { |
no outgoing calls
no test coverage detected