Skip to content

Commit 1b08e62

Browse files
BridgeARtargos
authored andcommittedMar 30, 2019
util: improve proxy inspection
This makes sure the brace is actually handled as any other brace. It was handled differently so far than any other brace and that had an impact on how the output would be formatted. PR-URL: #26919 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent bd006e1 commit 1b08e62

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed
 

‎lib/internal/util/inspect.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ function formatProxy(ctx, proxy, recurseTimes) {
404404
formatValue(ctx, proxy[1], recurseTimes)
405405
];
406406
ctx.indentationLvl -= 2;
407-
const str = reduceToSingleString(ctx, res, '', ['[', ']']);
408-
return `Proxy ${str}`;
407+
return reduceToSingleString(ctx, res, '', ['Proxy [', ']']);
409408
}
410409

411410
function findTypedConstructor(value) {

‎test/parallel/test-util-inspect-proxy.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@ const expected1 = 'Proxy [ {}, {} ]';
5050
const expected2 = 'Proxy [ Proxy [ {}, {} ], {} ]';
5151
const expected3 = 'Proxy [ Proxy [ Proxy [ {}, {} ], {} ], Proxy [ {}, {} ] ]';
5252
const expected4 = 'Proxy [ Proxy [ {}, {} ], Proxy [ Proxy [ {}, {} ], {} ] ]';
53-
const expected5 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], {} ],' +
54-
' Proxy [ {}, {} ] ],\n Proxy [ Proxy [ {}, {} ]' +
55-
', Proxy [ Proxy [Array], {} ] ] ]';
56-
const expected6 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], Proxy [Array]' +
57-
' ],\n Proxy [ Proxy [Array], Proxy [Array] ] ],\n' +
58-
' Proxy [ Proxy [ Proxy [Array], Proxy [Array] ],\n' +
53+
const expected5 = 'Proxy [\n ' +
54+
'Proxy [ Proxy [ Proxy [Array], {} ], Proxy [ {}, {} ] ],\n' +
55+
' Proxy [ Proxy [ {}, {} ], Proxy [ Proxy [Array], {} ] ] ]';
56+
const expected6 = 'Proxy [\n' +
57+
' Proxy [\n' +
58+
' Proxy [ Proxy [Array], Proxy [Array] ],\n' +
59+
' Proxy [ Proxy [Array], Proxy [Array] ] ],\n' +
60+
' Proxy [\n' +
61+
' Proxy [ Proxy [Array], Proxy [Array] ],\n' +
5962
' Proxy [ Proxy [Array], Proxy [Array] ] ] ]';
6063
assert.strictEqual(
6164
util.inspect(proxy1, { showProxy: true, depth: null }),

0 commit comments

Comments
 (0)