diff --git a/doc/api/util.md b/doc/api/util.md index b702d5adba3a2c..6cab40db100b4a 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -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`). diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index f59e7db3a9782c..fe21854e16aa7f 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -146,7 +146,7 @@ const inspectDefaultOptions = ObjectSeal({ customInspect: true, showProxy: false, maxArrayLength: 100, - maxStringLength: Infinity, + maxStringLength: 10000, breakLength: 80, compact: 3, sorted: false, diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index fab2a12a00ddf7..b4443984cbc263 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -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"