Uh oh!
There was an error while loading. Please reload this page.
fix(inspect): allow single-line format when breakLength is Infinity - #64238
fix(inspect): allow single-line format when breakLength is Infinity#64238hamidrezaghavami wants to merge 1 commit into
Conversation
ljharb
left a comment
There was a problem hiding this comment.
this definitely needs tests to cover the changed behavior. ideally, you'd also provide the tests' output absent this change.
hamidrezaghavami
commented
Jul 2, 2026
Hello, @ljharb The single-line formatting behaviour when breakLength is set to Infinity is covered in a test case that I have provided. |
Uh oh!
There was an error while loading. Please reload this page.
038a50a to
b91c45eCompareUh oh!
There was an error while loading. Please reload this page.
31523f9 to
3060df3Compareede2dd7 to
34da682Comparehamidrezaghavami
commented
Jul 6, 2026
@ljharb All formatting, linting, and core test suites are now fully passing (29/30 checks successful). The single remaining check (test-macOS) failed on an unrelated debugger timeout (test-debugger-exceptions.js 15000ms exceeded), which appears to be a macOS CI runner flake. Could you please re-run that failed macOS job when you have a moment to review? |
ljharb
commented
Jul 6, 2026
@hamidrezaghavami again, your test case already passes, so it's not a regression test. |
hamidrezaghavami
commented
Jul 6, 2026
@ljharb To clarify my intent: this patch is a performance early exit fast path inside isBelowBreakLength when breakLength === Infinity, avoiding unnecessary string width calculation loops. Because observable output is identical to main, standard tests pass on both branches. Should we label/track this strictly as a performance optimization/cleanup rather than a bug fix? |
ljharb
commented
Jul 6, 2026
ahh ok, that wasn't clear to me before |
Uh oh!
There was an error while loading. Please reload this page.
34da682 to
31719caCompareSigned-off-by: Hamid Reza Ghavami <hamidr.ghavami@gmail.com>
31719ca to
a881d0eComparehamidrezaghavami
commented
Jul 7, 2026
@ljharb The CI checks are fully green! I had to force-push one last time to shorten the test string to pass the 80-character max-len linter rule. Could you re-approve when you have a moment, so we can get this merged? |
Description
When calling
util.inspect()with abreakLengthconfiguration explicitly set toInfinity, the internal layout formatting logic should bypass multi-line chunking and formatting constraints entirely, allowing the contents to naturally evaluate on a single line.Currently,
isBelowBreakLengthgoes through a character length loop calculation even when length checks are logically unnecessary due to the infinite upper bound. This change introduces an explicit early return branch withinisBelowBreakLengthwhenctx.breakLength === Infinity, properly enabling a clean, un-wrapped single-line string formatting mode.Checklist