Skip to content

Commit 7c4e775

Browse files
committed
fix(testing): fallback for inspect on non-deno runtimes
1 parent de9c7cf commit 7c4e775

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

testing/highlight.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import hljs from "highlight.js/lib/core"
33
import typescript from "highlight.js/lib/languages/typescript"
44
import { bgBlack, bgWhite, bgYellow, black, blue, cyan, gray, green, stripAnsiCode, underline, yellow } from "@std/fmt/colors"
55
import { unescape } from "@std/html/entities"
6+
import { runtime } from "./runtime.ts"
67
hljs.registerLanguage("typescript", typescript)
78

89
/**
@@ -42,6 +43,9 @@ export function inspect(value: unknown): string {
4243
if (typeof value === "function") {
4344
return "fn"
4445
}
46+
if (runtime !== "deno") {
47+
return `${value}`
48+
}
4549
return Deno.inspect(value, { colors: true, compact: true }).replace(/\n\s+/g, " ")
4650
}
4751

0 commit comments

Comments
 (0)