phenomnomnominal / betterer

betterer makes it easier to make incremental improvements to your codebase
MIT License
569 stars 38 forks source link

stdout not matching the printed output - line length is different #1152

Open kubaprzetakiewicz opened 1 year ago

kubaprzetakiewicz commented 1 year ago

Describe the bug

Running (npm|pnpm|yarn) -s betterer ci outputs a "pretty-printed" result, e.g.

   \ | /     _         _   _
 '-.ooo.-'  | |__  ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \/ _ \ __| __/ _ \ '__/ _ \ '__|
 .-'ooo'-.  | |_)|  __/ |_| ||  __/ | |  __/ |
   / | \    |_.__/\___|\__|\__\___|_|  \___|_|

πŸŽ‰ Betterer: 6 tests done!
βœ… Example test #1: "Example test #1" stayed the same. (2 issues) 😐
βœ… Example test #2: "Example test #2" stayed the same. (2 issues) 😐
βœ… Example test #3 - a longer label: "Example test #3 - a longer label" stayed the same. (9 issues) 😐
βœ… Example test #4 - suuuuuuper long label to make a convincing point!: "Example test #4 - suuuuuuper long label to make a convincing point!" stayed the same. (7 issues) 😐
βœ… #5: "#5" stayed the same. (2 issues) 😐
βœ… This is #6: "This is #6" stayed the same. (3 issues) 😐

6 tests got checked. πŸ€”
6 tests stayed the same. 😐

but when the standard output is redirected to e.g. a file (i want to use it in CI for external reporting - Slack, PR comments, etc.) the output is different:

   \ | /     _         _   _
 '-.ooo.-'  | |__  ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \/ _ \ __| __/ _ \ '__/ _ \ '__|
 .-'ooo'-.  | |_)|  __/ |_| ||  __/ | |  __/ |
   / | \    |_.__/\___|\__|\__\___|_|  \___|_|

πŸŽ‰ Betterer: 6 tests done!
βœ… Example test #1: "Example test #1" stayed the same. (2 issues) 😐
βœ… Example test #2: "Example test #2" stayed the same. (2 issues) 😐
βœ… Example test #3 - a longer label: "Example test #3 - a longer label" stayed
the same. (9 issues) 😐
βœ… Example test #4 - suuuuuuper long label to make a convincing point!: "Example
 test #4 - suuuuuuper long label to make a convincing point!" stayed the same.
(7 issues) 😐
βœ… #5: "#5" stayed the same. (2 issues) 😐
βœ… This is #6: "This is #6" stayed the same. (3 issues) 😐

6 tests got checked. πŸ€”
6 tests stayed the same. 😐

the lines are now wrapped which makes the output much less readable

To Reproduce

(npm|pnpm|yarn) -s betterer ci > output.txt
cat output.txt

Expected behavior The redirected output would match the printed output

Versions:

OS ``` ProductName: macOS ProductVersion: 13.4 BuildVersion: 22F66 ```
Betterer ``` 5.4.0 ```
Node ``` 20.3.0 ```
kubaprzetakiewicz commented 1 year ago

i'm purposefully ignoring the repeated Betterer logo in the beginning - it's escaped with cursor codes, so it doesn't really matter in my case