diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-06-15 15:33:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 15:33:13 -0400 |
commit | 984b8bf0c864310bb373a57aad1fea0b002b74fe (patch) | |
tree | 9293d0860edb0e8f687e9802b0f52271520e7003 /cli/tests/unit/console_test.ts | |
parent | 0c0058f1181d1fd6590f760a0375ead706043d32 (diff) |
fix(inspector): Deno.inspect should inspect the object the proxy represents rather than the target of the proxy (#10977)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r-- | cli/tests/unit/console_test.ts | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index a43bfdba3..8013da152 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -1737,18 +1737,42 @@ unitTest(function inspectIterableLimit(): void { unitTest(function inspectProxy(): void { assertEquals( stripColor(Deno.inspect( - new Proxy([1, 2, 3], { get(): void {} }), + new Proxy([1, 2, 3], {}), )), "[ 1, 2, 3 ]", ); assertEquals( stripColor(Deno.inspect( - new Proxy({ key: "value" }, { get(): void {} }), + new Proxy({ key: "value" }, {}), )), `{ key: "value" }`, ); assertEquals( stripColor(Deno.inspect( + new Proxy({}, { + get(_target, key) { + if (key === Symbol.toStringTag) { + return "MyProxy"; + } else { + return 5; + } + }, + getOwnPropertyDescriptor() { + return { + enumerable: true, + configurable: true, + value: 5, + }; + }, + ownKeys() { + return ["prop1", "prop2"]; + }, + }), + )), + `MyProxy { prop1: 5, prop2: 5 }`, + ); + assertEquals( + stripColor(Deno.inspect( new Proxy([1, 2, 3], { get(): void {} }), { showProxy: true }, )), |