diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts index b7377c1bc0..a3f0c13387 100644 --- a/std/testing/asserts.ts +++ b/std/testing/asserts.ts @@ -21,13 +21,13 @@ export class AssertionError extends Error { export function _format(v: unknown): string { let string = globalThis.Deno - ? Deno.inspect(v, { + ? stripColor(Deno.inspect(v, { depth: Infinity, sorted: true, trailingComma: true, compact: false, iterableLimit: Infinity, - }) + })) : String(v); if (typeof v == "string") { string = `"${string.replace(/(?=["\\])/g, "\\")}"`; @@ -303,7 +303,7 @@ export function assertStrictEquals( } /** - * Make an assertion that `actual` and `expected` are not strictly equal. + * Make an assertion that `actual` and `expected` are not strictly equal. * If the values are strictly equal then throw. * ```ts * assertNotStrictEquals(1, 1) diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts index f8a600d77a..4840bcf536 100644 --- a/std/testing/asserts_test.ts +++ b/std/testing/asserts_test.ts @@ -336,8 +336,10 @@ const createHeader = (): string[] => [ "", ]; -const added: (s: string) => string = (s: string): string => green(bold(s)); -const removed: (s: string) => string = (s: string): string => red(bold(s)); +const added: (s: string) => string = (s: string): string => + green(bold(stripColor(s))); +const removed: (s: string) => string = (s: string): string => + red(bold(stripColor(s))); Deno.test({ name: "pass case",