mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 20:25:12 -05:00
fix(std/testing): assertion diff color (#7499)
This commit is contained in:
parent
aa81bc73d9
commit
aa657d6493
2 changed files with 7 additions and 5 deletions
|
@ -21,13 +21,13 @@ export class AssertionError extends Error {
|
||||||
|
|
||||||
export function _format(v: unknown): string {
|
export function _format(v: unknown): string {
|
||||||
let string = globalThis.Deno
|
let string = globalThis.Deno
|
||||||
? Deno.inspect(v, {
|
? stripColor(Deno.inspect(v, {
|
||||||
depth: Infinity,
|
depth: Infinity,
|
||||||
sorted: true,
|
sorted: true,
|
||||||
trailingComma: true,
|
trailingComma: true,
|
||||||
compact: false,
|
compact: false,
|
||||||
iterableLimit: Infinity,
|
iterableLimit: Infinity,
|
||||||
})
|
}))
|
||||||
: String(v);
|
: String(v);
|
||||||
if (typeof v == "string") {
|
if (typeof v == "string") {
|
||||||
string = `"${string.replace(/(?=["\\])/g, "\\")}"`;
|
string = `"${string.replace(/(?=["\\])/g, "\\")}"`;
|
||||||
|
|
|
@ -336,8 +336,10 @@ const createHeader = (): string[] => [
|
||||||
"",
|
"",
|
||||||
];
|
];
|
||||||
|
|
||||||
const added: (s: string) => string = (s: string): string => green(bold(s));
|
const added: (s: string) => string = (s: string): string =>
|
||||||
const removed: (s: string) => string = (s: string): string => red(bold(s));
|
green(bold(stripColor(s)));
|
||||||
|
const removed: (s: string) => string = (s: string): string =>
|
||||||
|
red(bold(stripColor(s)));
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
name: "pass case",
|
name: "pass case",
|
||||||
|
|
Loading…
Add table
Reference in a new issue