summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-05-11 14:08:17 +0100
committerGitHub <noreply@github.com>2023-05-11 15:08:17 +0200
commitffb0318e4a2427abd0ab9c77ab48ef57357b0dc0 (patch)
tree20c1f34fc49b00966584ef01d2eafb35aa2eabae /cli/tests/unit/console_test.ts
parent2ba9ccc1ab25e5c631afcbb12b53f4545ca7f750 (diff)
fix(console): handle error when inspecting promise-like (#19083)
Fixes https://discord.com/channels/684898665143206084/684911491035430919/1105900195406958672. This was caused by: - A `TypeError` from `core.getPromiseDetails()` for promise-likes which also lead to that code path. - Swallowing internal formatting errors by returning `undefined`. I've made it so that a special message is formatted in that case instead (note that this case is fixed now): ![image](https://github.com/denoland/deno/assets/29990554/65bb9612-60b2-4e31-bf5e-e20976601593)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index 0bd53dc77..c4f2f64a4 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -2235,6 +2235,13 @@ Deno.test(function inspectWithPrototypePollution() {
}
});
+Deno.test(function inspectPromiseLike() {
+ assertEquals(
+ Deno.inspect(Object.create(Promise.prototype)),
+ "Promise { <unknown> }",
+ );
+});
+
Deno.test(function inspectorMethods() {
console.timeStamp("test");
console.profile("test");