(expected: unknown, received: unknown)
| 270 | // Almost redundant with function in jest-matcher-utils, |
| 271 | // except no line diff for any strings. |
| 272 | const isLineDiffableArg = (expected: unknown, received: unknown): boolean => { |
| 273 | const expectedType = getType(expected); |
| 274 | const receivedType = getType(received); |
| 275 | |
| 276 | if (expectedType !== receivedType) { |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | if (isPrimitive(expected)) { |
| 281 | return false; |
| 282 | } |
| 283 | |
| 284 | if ( |
| 285 | expectedType === 'date' || |
| 286 | expectedType === 'function' || |
| 287 | expectedType === 'regexp' |
| 288 | ) { |
| 289 | return false; |
| 290 | } |
| 291 | |
| 292 | if (expected instanceof Error && received instanceof Error) { |
| 293 | return false; |
| 294 | } |
| 295 | |
| 296 | if ( |
| 297 | expectedType === 'object' && |
| 298 | typeof (expected as any).asymmetricMatch === 'function' |
| 299 | ) { |
| 300 | return false; |
| 301 | } |
| 302 | |
| 303 | if ( |
| 304 | receivedType === 'object' && |
| 305 | typeof (received as any).asymmetricMatch === 'function' |
| 306 | ) { |
| 307 | return false; |
| 308 | } |
| 309 | |
| 310 | return true; |
| 311 | }; |
| 312 | |
| 313 | const printResult = (result: any, expected: unknown) => |
| 314 | result.type === 'throw' |
no test coverage detected