From 1211b9a72f291d487c4ded97b005484e0c6a8a87 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Apr 2020 12:19:41 -0400 Subject: [PATCH] util: change default value of `maxStringLength` to 10000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/nodejs/node/pull/32392 PR-URL: https://github.com/nodejs/node/pull/32744 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Matheus Marchini Reviewed-By: Trivikram Kamat --- doc/api/util.md | 2 +- lib/internal/util/inspect.js | 2 +- test/parallel/test-util-inspect.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) 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"