-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
util: honor breakLength Infinity when depth is Infinity #60783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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