util: fix map entries inspection

This makes sure the arrays returned by Map#entries() are handled as
any other array instead of just visualizing the entries as array.
Therefore options should have an impact on the arrays.

PR-URL: https://github.com/nodejs/node/pull/26918
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Ruben Bridgewater committed 2019-03-29 11:04:20 +01:00
1 parent f9da55cca2
commit 520b3e63ea
2 files changed
+19 -15

No files matched your search

+4 -1
View File
@@ -1017,7 +1017,10 @@ if (typeof Symbol !== 'undefined') {
// Test Set iterators.
{
const aSet = new Set([1, 3]);
const aSet = new Set([1]);
assert.strictEqual(util.inspect(aSet.entries(), { compact: false }),
'[Set Entries] {\n [\n 1,\n 1\n ]\n}');
aSet.add(3);
assert.strictEqual(util.inspect(aSet.keys()), '[Set Iterator] { 1, 3 }');
assert.strictEqual(util.inspect(aSet.values()), '[Set Iterator] { 1, 3 }');
const setEntries = aSet.entries();