-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Pretty print carton test
output
#144
Conversation
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.
This is marvelous! 👏 I myself lost all hope for parsing XCTest output long time ago, and that's the reason I hacked an XCTest JSON output formatter in our development snapshots (but it didn't land in our 5.3 due to lack of time). This amazing work means I can revert the JSON output formatter, as it had almost no chances to land upstream in its current form. Even though XCTest JSON output is more elegant in theory.
Maybe this output parser could become a separate library at some point? But I'm surely fine with merging it now here and battle-testing for a bit to make sure we can publish it later as a separate library for other people to rely on.
public protocol ProcessOutputParser { | ||
/// Parse the output of a `Process`, format it, then output in the `InteractiveWriter`. | ||
func parse(_ output: String, _ terminal: InteractiveWriter) | ||
var onlyOnFail: Bool { get } |
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.
Please add a doc comment for this property.
Yeah it'd be nice to separate these from carton. Hopefully we can get Json output in the future (and for compiler output too 🤞) |
The compiler can already output parseable diagnostics, I'm not sure about JSON, but bitstream output is available for sure, and now can be parsed in pure Swift thanks to swiftlang/swift-tools-support-core#120 and swiftlang/swift-tools-support-core#145. |
Oh, awesome! |
I tried to implement the DiagnosticsParser with |
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.
Thanks 👍
Seems like TSC support for diagnostics in the bitcode format is unfinished 😕 |
Generalized the
ProcessRunner
to take aProcessOutputParser
(currently onlyDiagnosticsParser
andTestsParser
conform).Here's a sample of passing & failing test cases:
And here's what the raw output of
swift test
would be: