From a2262c11d750c922e6cdea1cac5ff80f603d67e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=91=9E=E4=B8=B0?= Date: Mon, 26 Sep 2022 22:55:58 +0800 Subject: fix(ext/console): fix error when logging a proxied Date (#16018) --- cli/tests/unit/console_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/tests/unit/console_test.ts') diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 0ddbe278c..0ab2829fc 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -1678,6 +1678,15 @@ Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedMap() { }); }); +// console.log(new Proxy(new Date(), {})) +Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedDate() { + mockConsole((console, out) => { + const proxiedDate = new Proxy(new Date("2022-09-24T15:59:39.529Z"), {}); + console.log(proxiedDate); + assertEquals(stripColor(out.toString()), "2022-09-24T15:59:39.529Z\n"); + }); +}); + // console.dir test Deno.test(function consoleDir() { mockConsole((console, out) => { -- cgit v1.2.3