mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -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 {
|
||||
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)
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue