summaryrefslogtreecommitdiff
path: root/cli/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit')
-rw-r--r--cli/tests/unit/console_test.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index d7c4fd0cb..a43bfdba3 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -342,6 +342,14 @@ unitTest(function consoleTestStringifyCircular(): void {
stringify({ str: 1, [Symbol.for("sym")]: 2, [Symbol.toStringTag]: "TAG" }),
'TAG { str: 1, [Symbol(sym)]: 2, [Symbol(Symbol.toStringTag)]: "TAG" }',
);
+ assertEquals(
+ stringify({
+ [Deno.customInspect]: function () {
+ return Deno.inspect(this);
+ },
+ }),
+ "[Circular]",
+ );
// test inspect is working the same
assertEquals(stripColor(Deno.inspect(nestedObj)), nestedObjExpected);
});
@@ -878,12 +886,19 @@ unitTest(function consoleTestWithCustomInspectorError(): void {
}
}
+ const a = new A();
assertThrows(
- () => stringify(new A()),
+ () => stringify(a),
Error,
"BOOM",
"Custom inspect won't attempt to parse if user defined function throws",
);
+ assertThrows(
+ () => stringify(a),
+ Error,
+ "BOOM",
+ "Inpsect should fail and maintain a clear CTX_STACK",
+ );
});
unitTest(function consoleTestWithCustomInspectFunction(): void {