From 2e766a6adf9c6a2859a134ed4184cbb9d5558a20 Mon Sep 17 00:00:00 2001 From: Leko Date: Tue, 29 Sep 2020 00:00:38 +0800 Subject: [PATCH] console: add Symbol.toStringTag property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Symbol.toStringTag property to console object to follow WPT changes Update WPT status of console and the repl test case Refs: https://github.com/web-platform-tests/wpt/pull/24717 PR-URL: https://github.com/nodejs/node/pull/35399 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Luigi Pinca Reviewed-By: Daijiro Wachi Reviewed-By: Anna Henningsen Reviewed-By: Zeyu Yang Reviewed-By: James M Snell --- lib/internal/console/constructor.js | 7 +++++++ test/parallel/test-repl.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index a2af66f4b8521c..af027cf3b3cc59 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -17,6 +17,7 @@ const { ReflectOwnKeys, Symbol, SymbolHasInstance, + SymbolToStringTag, WeakMap, } = primordials; @@ -228,6 +229,12 @@ ObjectDefineProperties(Console.prototype, { ...consolePropAttributes, value: groupIndentation }, + [SymbolToStringTag]: { + writable: false, + enumerable: false, + configurable: true, + value: 'console' + } }); } }, diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 73a919e5eacb3c..76dec355381299 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -757,7 +757,7 @@ const errorTests = [ { send: 'console', expect: [ - '{', + 'Object [console] {', ' log: [Function: log],', ' warn: [Function: warn],', ' dir: [Function: dir],',