( matcherName: string, options: MatcherHintOptions, thrown: Thrown | null, expected: AsymmetricMatcher, )
| 184 | }; |
| 185 | |
| 186 | const toThrowExpectedAsymmetric = ( |
| 187 | matcherName: string, |
| 188 | options: MatcherHintOptions, |
| 189 | thrown: Thrown | null, |
| 190 | expected: AsymmetricMatcher, |
| 191 | ): SyncExpectationResult => { |
| 192 | const pass = thrown !== null && expected.asymmetricMatch(thrown.value); |
| 193 | |
| 194 | const message = pass |
| 195 | ? () => |
| 196 | // eslint-disable-next-line prefer-template |
| 197 | matcherHint(matcherName, undefined, undefined, options) + |
| 198 | '\n\n' + |
| 199 | formatExpected('Expected asymmetric matcher: not ', expected) + |
| 200 | '\n' + |
| 201 | (thrown !== null && thrown.hasMessage |
| 202 | ? formatReceived('Received name: ', thrown, 'name') + |
| 203 | formatReceived('Received message: ', thrown, 'message') + |
| 204 | formatStack(thrown) |
| 205 | : formatReceived('Thrown value: ', thrown, 'value')) |
| 206 | : () => |
| 207 | // eslint-disable-next-line prefer-template |
| 208 | matcherHint(matcherName, undefined, undefined, options) + |
| 209 | '\n\n' + |
| 210 | formatExpected('Expected asymmetric matcher: ', expected) + |
| 211 | '\n' + |
| 212 | (thrown === null |
| 213 | ? DID_NOT_THROW |
| 214 | : thrown.hasMessage |
| 215 | ? formatReceived('Received name: ', thrown, 'name') + |
| 216 | formatReceived('Received message: ', thrown, 'message') + |
| 217 | formatStack(thrown) |
| 218 | : formatReceived('Thrown value: ', thrown, 'value')); |
| 219 | |
| 220 | return {message, pass}; |
| 221 | }; |
| 222 | |
| 223 | const toThrowExpectedObject = ( |
| 224 | matcherName: string, |
no test coverage detected