(a: unknown, b: unknown, expected: string)
| 8 | import { disposableStack } from "../internal/_testing.ts"; |
| 9 | |
| 10 | function assertDiffMessage(a: unknown, b: unknown, expected: string) { |
| 11 | const err = assertThrows(() => assertEquals(a, b), AssertionError); |
| 12 | // TODO(lionel-rowe): re-spell `fullExpectedMessage` indentation once https://github.com/denoland/std/issues/6830 |
| 13 | // is fixed |
| 14 | const fullExpectedMessage = dedent` |
| 15 | Values are not equal. |
| 16 | |
| 17 | |
| 18 | [Diff] Actual / Expected |
| 19 | |
| 20 | |
| 21 | ${expected} |
| 22 | `; |
| 23 | assertEquals( |
| 24 | // TODO(lionel-rowe): compare full messages without trimming once https://github.com/denoland/std/issues/6830 and |
| 25 | // https://github.com/denoland/std/issues/6831 are fixed |
| 26 | stripAnsiCode(err.message).trimEnd(), |
| 27 | fullExpectedMessage, |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | Deno.test(`assertEquals() truncates unchanged lines of large diffs when "${DIFF_CONTEXT_LENGTH}" is set`, async (t) => { |
| 32 | using stack = disposableStack(); |
no test coverage detected