-
Notifications
You must be signed in to change notification settings - Fork 678
fix(cli-test): remove the trailing newline from parsed cli outputs #2148
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
Conversation
mwbrooks
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.
💅🏻 So much nicer!
| logger.verbose(`Output: ${this.removeANSIcolors(data.toString())}`); | ||
| const output = this.removeANSIcolors(data.toString()); | ||
| sh.output += output; | ||
| logger.verbose(`Output: ${output.replace(/\r?\n$/, '')}`); |
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.
Taking it to the next level with \r? 🪟
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.
Of course - always keeping the cartridge return in mind! But only sometimes 😉
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2148 +/- ##
==========================================
+ Coverage 91.89% 91.93% +0.04%
==========================================
Files 38 38
Lines 10320 10322 +2
Branches 649 651 +2
==========================================
+ Hits 9484 9490 +6
+ Misses 824 820 -4
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
@mwbrooks Thanks a ton for another fast review! I noticed test coverage dropped a bit with this initial change, but I'm glad that called out a gap in the tests! A few cases were added to cover how outputs are handled with a focus on these not being adjusted (aside from ANSI removals). With that, I think now's a nice time to merge! I'll follow up later with #2147 and then the promised release and then the actual updates to our tests 🎁 ✨ |
Summary
This PR removes the trailing newline found in CLI outputs before logging to
errororverbosesince the logger adds a newline itself!No change is made to the captured shell outputs, besides the existing
removeANSIcolorsfunction, to avoid breaking outputs that expect certain linebreaks 🙏 ✨Preview
The following example uses changes in #2147 to showcase linebreaks:
Before changes
After changes
Requirements