diff --git a/lib/util.js b/lib/util.js index 45d98de194c836..df8d5e238db1d5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -629,14 +629,14 @@ function formatValue(ctx, value, recurseTimes, ln) { if (ctx.showHidden) { formatter = formatWeakSet; } else { - extra = '[items unknown]'; + extra = ''; } } else if (isWeakMap(value)) { braces[0] = `${getPrefix(constructor, tag)}{`; if (ctx.showHidden) { formatter = formatWeakMap; } else { - extra = '[items unknown]'; + extra = ''; } } else { // Check boxed primitives other than string with valueOf() diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 2b8e14e45f64e6..7402a57a4a6d59 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1361,7 +1361,7 @@ util.inspect(process); assert.strictEqual(out, expect); out = util.inspect(weakMap); - expect = 'WeakMap { [items unknown] }'; + expect = 'WeakMap { }'; assert.strictEqual(out, expect); out = util.inspect(weakMap, { maxArrayLength: 0, showHidden: true }); @@ -1385,7 +1385,7 @@ util.inspect(process); assert.strictEqual(out, expect); out = util.inspect(weakSet); - expect = 'WeakSet { [items unknown] }'; + expect = 'WeakSet { }'; assert.strictEqual(out, expect); out = util.inspect(weakSet, { maxArrayLength: -2, showHidden: true });