Skip to content

Commit 0e98e22

Browse files
committed
fixup!
1 parent 2ac85bd commit 0e98e22

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/internal/util/inspect.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ const {
173173
isModuleNamespaceObject,
174174
isNativeError,
175175
isPromise,
176-
isProxy,
177176
isSet,
178177
isSetIterator,
179178
isWeakMap,
@@ -1132,7 +1131,11 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
11321131
}
11331132
do {
11341133
if (proxy === null) {
1135-
return ctx.stylize('<Revoked Proxy>', 'special');
1134+
let formatted = ctx.stylize('<Revoked Proxy>', 'special');
1135+
for (let i = 0; i < proxies; i++) {
1136+
formatted = `${ctx.stylize('Proxy(', 'special')}${formatted}${ctx.stylize(')', 'special')}`;
1137+
}
1138+
return formatted;
11361139
}
11371140
value = proxy;
11381141
proxy = getProxyDetails(value, false);

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ assert.strictEqual(util.format('%s', proxy12), 'Proxy([ 1, 2, 3 ])');
201201
// Nested proxies should not trigger any proxy handlers.
202202
const nestedProxy = new Proxy(new Proxy(new Proxy({}, handler), {}), {});
203203

204-
assert.strictEqual(util.inspect(nestedProxy, { showProxy: true }), 'Proxy [ Proxy [ Proxy [ {}, [Object] ], {} ], {} ]');
204+
assert.strictEqual(
205+
util.inspect(nestedProxy, { showProxy: true }),
206+
'Proxy [ Proxy [ Proxy [ {}, [Object] ], {} ], {} ]'
207+
);
205208
assert.strictEqual(util.inspect(nestedProxy, { showProxy: false }), expected3NoShowProxy);
206209
}
207210

@@ -212,5 +215,5 @@ assert.strictEqual(util.format('%s', proxy12), 'Proxy([ 1, 2, 3 ])');
212215
const nestedProxy = new Proxy(revocable.proxy, {});
213216

214217
assert.strictEqual(util.inspect(nestedProxy, { showProxy: true }), 'Proxy [ <Revoked Proxy>, {} ]');
215-
assert.strictEqual(util.inspect(nestedProxy, { showProxy: false }), '<Revoked Proxy>');
218+
assert.strictEqual(util.inspect(nestedProxy, { showProxy: false }), 'Proxy(<Revoked Proxy>)');
216219
}

0 commit comments

Comments
 (0)