From 7748619dcfa120639f871158d9063fe2241fd3c9 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 11 Jun 2018 03:02:12 +0200 Subject: [PATCH] fixup: add requested change --- lib/util.js | 8 ++++---- test/parallel/test-util-inspect.js | 10 ++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/util.js b/lib/util.js index 73f0076f6ae840..f24430d791f7c6 100644 --- a/lib/util.js +++ b/lib/util.js @@ -711,11 +711,11 @@ function formatValue(ctx, value, recurseTimes) { } catch (err) { if (errors.isStackOverflowError(err)) { ctx.seen.pop(); - process.emitWarning( - 'Inspection reached the maximum call stack size. Incomplete ' + - 'inspected object returned.' + return ctx.stylize( + `[${constructor || tag || 'Object'}: Inspection interrupted ` + + 'prematurely. Maximum call stack size exceeded.]', + 'special' ); - return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special'); } throw err; } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index bd513ab05cb756..1f05f4987eeb41 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1418,15 +1418,9 @@ util.inspect(process); util.inspect(list), '{ next: { next: { next: [Object] } } }' ); - common.expectWarning({ - Warning: [ - 'Inspection reached the maximum call stack size. ' + - 'Incomplete inspected object returned.', - common.noWarnCode - ] - }); const longList = util.inspect(list, { depth: Infinity }); const match = longList.match(/next/g); assert(match.length > 1000 && match.length < 10000); - assert(longList.includes('[Object]')); + assert(longList.includes('[Object: Inspection interrupted ' + + 'prematurely. Maximum call stack size exceeded.]')); }