util: honor breakLength Infinity when depth is Infinity#60783
util: honor breakLength Infinity when depth is Infinity#60783Han5991 wants to merge 3 commits intonodejs:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60783 +/- ##
==========================================
+ Coverage 88.50% 88.51% +0.01%
==========================================
Files 703 703
Lines 208394 208404 +10
Branches 40189 40197 +8
==========================================
+ Hits 184430 184479 +49
+ Misses 15965 15925 -40
- Partials 7999 8000 +1
🚀 New features to boost your workflow:
|
BridgeAR
left a comment
There was a problem hiding this comment.
Thank you for the PR!
The issue is actually that compact does not take into account that breakLength might be infinite. A simpler fix is to just add && !NumberIsFinite(ctx.breakLength) next to https://github.com/nodejs/node/pull/60783/files#diff-ee826b416a72014ac81621cf3ecaeec6adcc40163f60775d157aa94618c80201R2627
That should result in the expected output.
|
@BridgeAR |
3a818c9 to
2a0a7d5
Compare
2a0a7d5 to
545a24f
Compare
util.inspect()was still inserting line breaks when bothbreakLengthanddepthwere set toInfinity. Grouping logic and the compactinline heuristics were ignoring the special “no wrapping” intent. This change adds an
isUnlimitedDepth()guard so the line-wrapping pathsare skipped when the user explicitly asks for infinite width and depth.
Fixes: #60475