Skip to content

Commit dcb0c8a

Browse files
committed
util: change default value of maxStringLength to 10000
Refs: nodejs#32392
1 parent 7251e8c commit dcb0c8a

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

doc/api/util.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ changes:
488488
negative to show no elements. **Default:** `100`.
489489
* `maxStringLength` {integer} Specifies the maximum number of characters to
490490
include when formatting. Set to `null` or `Infinity` to show all elements.
491-
Set to `0` or negative to show no characters. **Default:** `Infinity`.
491+
Set to `0` or negative to show no characters. **Default:** `10000`.
492492
* `breakLength` {integer} The length at which input values are split across
493493
multiple lines. Set to `Infinity` to format the input as a single line
494494
(in combination with `compact` set to `true` or any number >= `1`).

lib/internal/util/inspect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const inspectDefaultOptions = ObjectSeal({
146146
customInspect: true,
147147
showProxy: false,
148148
maxArrayLength: 100,
149-
maxStringLength: Infinity,
149+
maxStringLength: 10000,
150150
breakLength: 80,
151151
compact: 3,
152152
sorted: false,

test/parallel/test-util-inspect.js

+1
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,7 @@ assert.strictEqual(
27822782

27832783
{
27842784
const x = 'a'.repeat(1e6);
2785+
assert(util.inspect(x).endsWith('... 990000 more characters'));
27852786
assert.strictEqual(
27862787
util.inspect(x, { maxStringLength: 4 }),
27872788
"'aaaa'... 999996 more characters"

0 commit comments

Comments
 (0)