From c9fece38c8dc872303fd0f5d6bf0ffc44bea7f4f Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 5 Apr 2019 22:18:16 +0200 Subject: [PATCH] util: change inspect compact and breakLength default This changes the `compact` default from `true` to `3`. That mode changes arrays to be grouped together, it alignes multiple small entries on a single line in similar to `compact` true but only for the most inner three depth levels and the closing brackets are always on the same indentation as the openeing of the object instead of at the same line as another property. Big strings will be naturally broken into multiple lines instead of having one huge line that is not well readable. The output size mainly stays the same that way while it will be smaller in case of big arrays. Increasing the `breakLength` to 80 adjusts for most terminals that support at least 80 characters in a single line and improves the general output that way. A lot of calculations use the `breakLength` to determine the concrete behavior. PR-URL: https://github.com/nodejs/node/pull/27109 Reviewed-By: Anna Henningsen Reviewed-By: Minwoo Jung Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- doc/api/util.md | 13 +- lib/internal/util/inspect.js | 4 +- test/parallel/test-console-group.js | 6 +- test/parallel/test-console.js | 8 +- test/parallel/test-http2-stream-client.js | 2 +- test/parallel/test-repl-pretty-stack.js | 10 +- test/parallel/test-repl-underscore.js | 5 +- test/parallel/test-repl.js | 5 +- test/parallel/test-util-format.js | 95 ++++++----- test/parallel/test-util-inspect-proxy.js | 17 +- test/parallel/test-util-inspect.js | 153 +++++++++--------- ...test-whatwg-encoding-custom-textdecoder.js | 10 +- .../test-whatwg-url-custom-inspect.js | 32 ++-- 13 files changed, 198 insertions(+), 162 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 6a8b30ef7ae1b6..ceaa01d5b0ca10 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -390,6 +390,10 @@ stream.write('With ES6');