summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-10-12 03:52:20 +0800
committerGitHub <noreply@github.com>2020-10-11 21:52:20 +0200
commit86dc55134ef25c1bc4f8db6c3c0dc635c1660ea4 (patch)
tree710c6888247463210f5388231f9742d87cdd2654 /cli/tests/unit/console_test.ts
parent08f3ae92d3935559a5134bc5da900d3784142bf3 (diff)
fix(cli/console): only inspect getters with option (#7830)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts22
1 files changed, 20 insertions, 2 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index 46798fdf3..df1420345 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -1494,14 +1494,32 @@ unitTest(function inspectString(): void {
);
});
-unitTest(function inspectGetterError(): void {
+unitTest(function inspectGetters(): void {
+ assertEquals(
+ stripColor(Deno.inspect({
+ get foo() {
+ return 0;
+ },
+ })),
+ "{ foo: [Getter] }",
+ );
+
+ assertEquals(
+ stripColor(Deno.inspect({
+ get foo() {
+ return 0;
+ },
+ }, { getters: true })),
+ "{ foo: 0 }",
+ );
+
assertEquals(
Deno.inspect({
// deno-lint-ignore getter-return
get foo() {
throw new Error("bar");
},
- }),
+ }, { getters: true }),
"{ foo: [Thrown Error: bar] }",
);
});