-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add line wrap disablement to ConsoleReporter #433
Conversation
9240df9
to
ba15ca8
Compare
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.
That's a nice idea! Let's wait for UnkindPartition/ansi-terminal#171 to be released, then I'll prepare a more in-depth review.
-- line will be cleared later or the test tree printing will | ||
-- itself wrap. | ||
withoutLineWrap :: IO () -> IO () | ||
withoutLineWrap m = do |
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.
Shall we use bracket
?
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.
I don't know really what the best practice is here. Printing is quick so I don't see it being interrupted by an async exception. Printing could result in an exception caused by stdout becoming unavailable, but in that case we can't print the enableLineWrap
code anyway, so there is no recovery.
It does seem natural to use bracket
though. It's up to you.
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.
Did it for now.
ba15ca8
to
063fed0
Compare
Please update the Cabal file with |
Or, even better, let's guard usage of |
@Bodigrim ansi-terminal 1.1.2 has been released and I've updated this PR to have it as a minimum bound. 🥳 Edit: I didn't see your above comments, github issue. |
bec56cf
to
ecd50f0
Compare
The latest update should address all feedback thus far. |
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.
We certainly benefit from no line wrapping when executing tests with --hide-successes
. But do we benefit from disabling line wrapping in the absence of --hide-successes
? Maybe it should be used only when --hide-successes
is enabled?..
I argue that we do benefit from disabling line wrapping without |
That's a good argument. My main concern is that without line wrapping |
Co-authored-by: ˌbodʲɪˈɡrʲim <[email protected]>
5d49cc7
to
c304f94
Compare
That's an excellent point. I undid that part of the change, now the result is not wrapped. |
Thanks, that's awesome! |
I don't propose changing cabal.project, this is just for a demo until the PR to ansi-terminal is merged (UnkindPartition/ansi-terminal#171)I saw that our test suite leaves garbage in the terminal output despite using
--hide-successes
. This turns out to be worse the narrower my terminal is. The more general problem is thatConsoleReporter
leaves garbage in the terminal when the lines it prints are wrapped, because it doesn't know to clear multiple lines, just the most recent one. This PR fixes that by disabling line wrapping while printing that line.This PR makes
ConsoleReporter
's ANSI tricks clean up after themselves properly in the presence of a narrow terminal, a long test name, or a long progress message, including those printed bytestCaseWithSteps
from tasty-hunit. It also prevents test group names from wrapping, because that has the same cause.