Files
3dverse-testtask/vendor/deno.land/std@0.191.0/testing/_format.ts
T
didier amyot 1f2ea8b7e5 Added test package in nix flake to automatically run tests.
To be able to do such, it was required to add the vendor directory
to the git project.
2023-06-10 09:33:04 -04:00

24 lines
705 B
TypeScript

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
/**
* Converts the input into a string. Objects, Sets and Maps are sorted so as to
* make tests less flaky
* @param v Value to be formatted
*/
export function format(v: unknown): string {
// deno-lint-ignore no-explicit-any
const { Deno } = globalThis as any;
return typeof Deno?.inspect === "function"
? Deno.inspect(v, {
depth: Infinity,
sorted: true,
trailingComma: true,
compact: false,
iterableLimit: Infinity,
// getters should be true in assertEquals.
getters: true,
})
: `"${String(v).replace(/(?=["\\])/g, "\\")}"`;
}