Skip to content

Commit

Permalink
fixup: add requested change
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Jun 11, 2018
1 parent ef4e8d3 commit 7748619
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 2 additions & 8 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.]'));
}

0 comments on commit 7748619

Please sign in to comment.