summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-09-19 12:24:19 -0600
committerGitHub <noreply@github.com>2023-09-19 18:24:19 +0000
commit612818d04399ef706df3df5ac94e6ef7e633cff7 (patch)
tree14d5f4313efe9fdc69a4ee3f7b0f5e72f62f7747 /cli/tests/unit/console_test.ts
parent40122d7f2a867660900612980dfc75eece0d5e29 (diff)
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect (#20568)
Fixes #20561
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index 7dac7ca77..d8990559e 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -1051,6 +1051,18 @@ Deno.test(function consoleTestWithCustomInspectorUsingInspectFunc() {
assertEquals(stringify(new A()), "b { c: 1 }");
});
+Deno.test(function consoleTestWithConstructorError() {
+ const obj = new Proxy({}, {
+ getOwnPropertyDescriptor(_target, name) {
+ if (name == "constructor") {
+ throw "yikes";
+ }
+ return undefined;
+ },
+ });
+ assertEquals(Deno.inspect(obj), "{}");
+});
+
Deno.test(function consoleTestWithCustomInspectorError() {
class A {
[customInspect](): never {