Skip to content
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

suppress printing package names with no tests #228

Closed
renkam opened this issue Jan 11, 2022 · 6 comments
Closed

suppress printing package names with no tests #228

renkam opened this issue Jan 11, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@renkam
Copy link

renkam commented Jan 11, 2022

Is there a way to avoid printing packages when only skipped tests or no tests at all are in package?

@dnephin dnephin added the enhancement New feature or request label Jan 15, 2022
@dnephin
Copy link
Member

dnephin commented Jan 15, 2022

Currently there is no way to hide output for empty packages. Are you looking for option for the pkgname format , or one of the others?

@renkam
Copy link
Author

renkam commented Jan 18, 2022

Probably pkgname.
I am using -f dots-v2 and in my project there is a lot of packages that have no tests. Printing those packages names gives me no value and pollutes the output.

@kokizzu
Copy link

kokizzu commented Feb 25, 2022

I used this:

gotestsum -f pkgname-and-test-fails | grep -v ∅ 
# or
gotestsum -f testname | grep -v EMPTY

but the color is gone

@dnephin
Copy link
Member

dnephin commented Feb 28, 2022

As a workaround to the missing color, you can use this:

gotestsum --no-color=false

I think it would also be ok to add an option to hide empty packages, but I'm not sure yet how that should work.

@flowchartsman
Copy link
Contributor

flowchartsman commented Nov 3, 2022

I made a PR for this, adding a --skip-empty option that only works if you are testing ./..., since that's the probably the only situation where you would want to transparently skip missing tests, and would be the situation where you would encounter them the most. If you're being explicit about testing targets, then you should see output for everything you specify, missing or not.

This was a bit tricky as I had to track missing stuff in two places to intercept it both before it is tracked for summary and before it's streamed to the formatters. In both cases I use the initial output starting with a ? to mark the package as empty from that point forward, after which all entries from that package are dropped. There might be a better method, but this seemed the most straightforward.

Wasn't sure where to add tests beyond arg checking, since AFAICT all of the testing harnesses that do golden file comparison on output are geared strictly to formatters, which my solution bypasses to avoid adding skipping behavior to all formatters.

@dnephin
Copy link
Member

dnephin commented Dec 17, 2022

Done in #288 and #283

@dnephin dnephin closed this as completed Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants