Add option to not show summary
Hello,
Thank you to create and maintain this tool!
I think it could be usefull to add an option to hide the summary. Or hide a part of them.
By exemple: show only the summary where the tests are failed.
What do you think?
Thanks !
Do you mean adding a flag like -fail-only and only display the non-passing tests in both the table and package tables?
Yes exactly.
In case having big codebase, it's hard to see the failed tests
Not a bad idea!
Before implementing this, I'd like to modify the behaviour of the Tests Table to include FAIL tests. Currently, they are omitted from the Tests Table and always displayed in the output preceding the Package Table.
Once those are displayed in that table, we can think about adding a -fail-only flag to limit the output to include only failed tests.
I'm curious @Itarix, if there are NO failed tests, what should the output be?
If no tests failed, the output can be a simple sentence as : No test failed or something like that.
What do you think about that?
Hi, are there any plans on having this implemented? We are facing a similar problem where a large codebase (having a lot of packages) makes the failing tests a bit harder to notice. Thank you so much for maintaining this btw! šš¼
Just a matter of finding time to add new features. I've wanted this for a while, so maybe incentive enough to add as more folks request it.
If you could drop a comment on your expected/ideal behavior that'd be great.
I would say either have
-
--fail-only -
-mode=ciwith anos.Exit(1)(maybe not enough clear about what it will do) -
-status=fail
When we specify that we would get in output only the fail tests.
The most important is to see which test and where and if possible the reason, that's why the tests table seems more usefull.
In my mind having it in package table would make hard to get infos quickly
Hi! I really enjoy using this library and would love to contribute to making it even better.
I'm working on https://github.com/mfridman/tparse/pull/149 to address the first step mentioned in https://github.com/mfridman/tparse/issues/90#issuecomment-1566451982 - adding failed tests to the Tests Table.
I have one clarification question about the table display condition:
Currently, the Tests Table only appears when -pass, -skip, or -all flags are specified (app.go:131-132).
https://github.com/mfridman/tparse/blob/ba2512e7be150bfcbd6f6220d517d3741f8f2f75/internal/app/app.go#L131-L132
With this PR, failed tests are now included in the table data, but I want to confirm the intended behavior:
Option A: Keep the current display condition unchanged
- Table only appears with
-pass,-skip, or-allflags - When these flags are used, failed tests will also appear in the table
- A future
-fail-onlyflag would also trigger table display
Option B: Always show table when there are failed tests
- Table automatically appears when failures exist (even without any flags)
- This would essentially make "show failed tests in table" the default behavior
-
-pass/-skip/-allflags would add passed/skipped tests to the table - A future
-fail-onlyflag might become redundant
I'm leaning toward Option A to maintain backward compatibility and keep the current explicit flag-based design. This way, the -fail-only flag would have a clear purpose when added later.
Does this align with your vision? Iād be grateful for your thoughts.
Agreed on solution A
I would see it as a CI mod:
- only fail (for
fail-only) - indicate to a system with an exit status 1 it's not passing
I think we should exit status 1 when fail happen while we display all
@Itarix
Thanks for confirming Option A! That makes sense for maintaining backward compatibility and keeping the flag-based design clear.
Regarding the exit status: I checked the code and ExitCode() already returns 1 when there are failed tests (process.go:296-297), regardless of which flags are used. So the behavior should be correct for CI usage.
https://github.com/mfridman/tparse/blob/ba2512e7be150bfcbd6f6220d517d3741f8f2f75/parse/process.go#L296-L297
@mfridman When you have a chance, could you review #149? The PR implements Option A as discussed:
- Table display condition remains unchanged (app.go:132) - table only appears with
-pass,-skip, or-allflags - When these flags are used, failed tests are now included in the table
- This sets up the foundation for adding
-fail-onlylater, which would also trigger table display
Let me know if there's anything I should adjust. Thanks!
Thanks for opening a PR, I'll try and get that reviewed soon-ish.