mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
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: https://github.com/nodejs/node/pull/26919 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
3cf1ffebab
commit
4bfc06f6b5
@ -423,8 +423,7 @@ function formatProxy(ctx, proxy, recurseTimes) {
|
||||
formatValue(ctx, proxy[1], recurseTimes)
|
||||
];
|
||||
ctx.indentationLvl -= 2;
|
||||
const str = reduceToSingleString(ctx, res, '', ['[', ']']);
|
||||
return `Proxy ${str}`;
|
||||
return reduceToSingleString(ctx, res, '', ['Proxy [', ']']);
|
||||
}
|
||||
|
||||
function findTypedConstructor(value) {
|
||||
|
@ -49,7 +49,8 @@ assert.strictEqual(handler, details[1]);
|
||||
|
||||
assert.strictEqual(
|
||||
util.inspect(proxyObj, opts),
|
||||
'Proxy [ [ 1, 2, 3 ],\n' +
|
||||
'Proxy [\n' +
|
||||
' [ 1, 2, 3 ],\n' +
|
||||
' { getPrototypeOf: [Function: getPrototypeOf],\n' +
|
||||
' setPrototypeOf: [Function: setPrototypeOf],\n' +
|
||||
' isExtensible: [Function: isExtensible],\n' +
|
||||
@ -86,12 +87,15 @@ const expected1 = 'Proxy [ {}, {} ]';
|
||||
const expected2 = 'Proxy [ Proxy [ {}, {} ], {} ]';
|
||||
const expected3 = 'Proxy [ Proxy [ Proxy [ {}, {} ], {} ], Proxy [ {}, {} ] ]';
|
||||
const expected4 = 'Proxy [ Proxy [ {}, {} ], Proxy [ Proxy [ {}, {} ], {} ] ]';
|
||||
const expected5 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], {} ],' +
|
||||
' Proxy [ {}, {} ] ],\n Proxy [ Proxy [ {}, {} ]' +
|
||||
', Proxy [ Proxy [Array], {} ] ] ]';
|
||||
const expected6 = 'Proxy [ Proxy [ Proxy [ Proxy [Array], Proxy [Array]' +
|
||||
' ],\n Proxy [ Proxy [Array], Proxy [Array] ] ],\n' +
|
||||
' Proxy [ Proxy [ Proxy [Array], Proxy [Array] ],\n' +
|
||||
const expected5 = 'Proxy [\n ' +
|
||||
'Proxy [ Proxy [ Proxy [Array], {} ], Proxy [ {}, {} ] ],\n' +
|
||||
' Proxy [ Proxy [ {}, {} ], Proxy [ Proxy [Array], {} ] ] ]';
|
||||
const expected6 = 'Proxy [\n' +
|
||||
' Proxy [\n' +
|
||||
' Proxy [ Proxy [Array], Proxy [Array] ],\n' +
|
||||
' Proxy [ Proxy [Array], Proxy [Array] ] ],\n' +
|
||||
' Proxy [\n' +
|
||||
' Proxy [ Proxy [Array], Proxy [Array] ],\n' +
|
||||
' Proxy [ Proxy [Array], Proxy [Array] ] ] ]';
|
||||
assert.strictEqual(
|
||||
util.inspect(proxy1, { showProxy: true, depth: null }),
|
||||
|
Loading…
Reference in New Issue
Block a user