tparse icon indicating copy to clipboard operation
tparse copied to clipboard

Add option to not show summary

Open Itarix opened this issue 2 years ago • 12 comments

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 !

Itarix avatar Feb 13 '23 14:02 Itarix

Do you mean adding a flag like -fail-only and only display the non-passing tests in both the table and package tables?

mfridman avatar Feb 19 '23 13:02 mfridman

Yes exactly.

In case having big codebase, it's hard to see the failed tests

Itarix avatar Feb 21 '23 19:02 Itarix

Not a bad idea!

mfridman avatar Feb 22 '23 13:02 mfridman

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?

CleanShot 2023-05-28 at 23 25 36@2x

mfridman avatar May 29 '23 03:05 mfridman

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?

Itarix avatar May 29 '23 17:05 Itarix

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! šŸ™ŒšŸ¼

smaven avatar Aug 29 '25 02:08 smaven

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.

mfridman avatar Aug 29 '25 12:08 mfridman

I would say either have

  • --fail-only
  • -mode=ci with an os.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

Itarix avatar Sep 08 '25 12:09 Itarix

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 -all flags
  • When these flags are used, failed tests will also appear in the table
  • A future -fail-only flag 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/-all flags would add passed/skipped tests to the table
  • A future -fail-only flag 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.

KoheiMatsuno99 avatar Oct 13 '25 03:10 KoheiMatsuno99

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 avatar Oct 23 '25 06:10 Itarix


@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 -all flags
  • When these flags are used, failed tests are now included in the table
  • This sets up the foundation for adding -fail-only later, which would also trigger table display

Let me know if there's anything I should adjust. Thanks!


KoheiMatsuno99 avatar Oct 28 '25 13:10 KoheiMatsuno99

Thanks for opening a PR, I'll try and get that reviewed soon-ish.

mfridman avatar Nov 03 '25 14:11 mfridman