Skip to content

Commit

Permalink
util: change default value of maxStringLength to 10000
Browse files Browse the repository at this point in the history
Refs: nodejs#32392

PR-URL: nodejs#32744
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
rosaxxny authored and addaleax committed Apr 13, 2020
1 parent 1f9761f commit 1211b9a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ changes:
negative to show no elements. **Default:** `100`.
* `maxStringLength` {integer} Specifies the maximum number of characters to
include when formatting. Set to `null` or `Infinity` to show all elements.
Set to `0` or negative to show no characters. **Default:** `Infinity`.
Set to `0` or negative to show no characters. **Default:** `10000`.
* `breakLength` {integer} The length at which input values are split across
multiple lines. Set to `Infinity` to format the input as a single line
(in combination with `compact` set to `true` or any number >= `1`).
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const inspectDefaultOptions = ObjectSeal({
customInspect: true,
showProxy: false,
maxArrayLength: 100,
maxStringLength: Infinity,
maxStringLength: 10000,
breakLength: 80,
compact: 3,
sorted: false,
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,7 @@ assert.strictEqual(

{
const x = 'a'.repeat(1e6);
assert(util.inspect(x).endsWith('... 990000 more characters'));
assert.strictEqual(
util.inspect(x, { maxStringLength: 4 }),
"'aaaa'... 999996 more characters"
Expand Down

0 comments on commit 1211b9a

Please sign in to comment.