Skip to content

breakLength inspect option is not respected with four or more levels of deepness when depth option is 3 or more #45193

@DamienGarrido

Description

@DamienGarrido

Version

v18.12.0

Platform

Linux ubuntu 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

util

What steps will reproduce the bug?

const { inspect } = require('util');
const inspectOptions = { depth: 3, breakLength: Infinity };

const obj_1 = { one: { two: { three: 'cool!' } } };
const obj_2 = { one: { two: { three: { four: 'boom!' } } } };

console.log(inspect(obj_1, inspectOptions));
console.log(inspect(obj_2, inspectOptions));

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

{ one: { two: { three: 'cool!' } } }
{ one: { two: { three: { four: 'boom!' } } } }

What do you see instead?

{ one: { two: { three: 'cool!' } } }
{
  one: { two: { three: { four: 'boom!' } } }
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions