(actual, expected, msg)
| 501 | throw new AssertionError(msg); |
| 502 | } |
| 503 | function assertStrictEquals(actual, expected, msg) { |
| 504 | if (Object.is(actual, expected)) { |
| 505 | return; |
| 506 | } |
| 507 | let message; |
| 508 | if (msg) { |
| 509 | message = msg; |
| 510 | } else { |
| 511 | const actualString = format(actual); |
| 512 | const expectedString = format(expected); |
| 513 | if (actualString === expectedString) { |
| 514 | const withOffset = actualString.split("\n").map((l)=>` ${l}`).join("\n"); |
| 515 | message = `Values have the same structure but are not reference-equal:\n\n${red(withOffset)}\n`; |
| 516 | } else { |
| 517 | try { |
| 518 | const stringDiff = typeof actual === "string" && typeof expected === "string"; |
| 519 | const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")); |
| 520 | const diffMsg = buildMessage(diffResult, { |
| 521 | stringDiff |
| 522 | }).join("\n"); |
| 523 | message = `Values are not strictly equal:\n${diffMsg}`; |
| 524 | } catch { |
| 525 | message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`; |
| 526 | } |
| 527 | } |
| 528 | } |
| 529 | throw new AssertionError(message); |
| 530 | } |
| 531 | function assertNotStrictEquals(actual, expected, msg) { |
| 532 | if (!Object.is(actual, expected)) { |
| 533 | return; |
nothing calls this directly
no test coverage detected
searching dependent graphs…