Papercut issue that I found difficult to explain in a few words to someone who got stung by it.
$ node
Welcome to Node.js v14.0.0-pre.
Type ".help" for more information.
> console.log([[[[[]]]]])
[ [ [ [Array] ] ] ]
undefined
> [[[[[]]]]]
[ [ [ [Array] ] ] ]
So far, so normal. But now:
> util.inspect.defaultOptions.depth = 42
42
> console.log([[[[[]]]]])
[
[ [ [ [] ] ] ]
]
undefined
> [[[[[]]]]]
[ [ [ [Array] ] ] ] // unaffected
Ideally the REPL would use the util.inspect.defaultOptions from the REPL context to format results.
I can try to take a look at this soon :)
REPL聽options should聽inherit from聽defaultOptions and聽only聽override what聽differs from聽the聽defaults.
This is working as expected. The defaultOptions are used while starting the REPL instance. There is another option that may be modified to change the repl writer settings during execution (util.inspect.replOptions). These will only work in the standalone repl.
I do plan on adding a configuration file for the REPL that allows to set the defaults up front.
Most helpful comment
This is working as expected. The defaultOptions are used while starting the REPL instance. There is another option that may be modified to change the repl writer settings during execution (
util.inspect.replOptions). These will only work in the standalone repl.I do plan on adding a configuration file for the REPL that allows to set the defaults up front.