You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, I want to thank you for this amazing tool. I've used it to get several packages to 100% test coverage now. Fantastic.
That said, perhaps I'm missing an option, but I would like to see the ability to only instrument and report the coverage for the top-level package under test (more generally, specifically named packages). There is already a way to exclude packages by name, however, I find myself not wanting to see test coverage for dependencies far more often than I want to see it. Dependencies have their own tests which ensure they work properly.
For an actual example, https://github.com/davecgh/go-spew/spew has 100% test coverage. However, when I run gocov against another package I'm developing right now that makes use of it, it reports coverage not only for the package I'm running it against, but for spew as well. Since the package under test doesn't exercise spew fully (spew has its own tests for that), it dutifully reports low test coverage. I can, of course, exclude the package, but there are several more deps too (all of which have their own tests). This results in a ton of low percentage coverage reports that are largely irrelevant since, in my opinion, it's not the job of a top-level package to test dependencies directly.
I think it would be far easier if there were, at the very least, a flag to ignore imported packages other than the current one under test or specifically named packages on the command line. Best case for me would be to reverse the behavior altogether where gocov only tests (or at least reports) the specific named package(s) unless given a flag to recurse.
The text was updated successfully, but these errors were encountered:
Thank you for your kind words. I'm glad you've found gocov useful.
Do you have the latest version of gocov? There was a change some time ago that introduced a boolean "-deps" flag, which is false by default. This is meant to do what you're talking about - toggle coverage analysis of dependencies. If you have the latest, and you're not setting that, then it sounds like a bug. Could you please confirm?
Doh! I did in fact need to update. The -deps flag set by default to false is exactly what I was after. Thanks for responding so quickly. I apologize for the already implemented request. I should've updated first.
First, I want to thank you for this amazing tool. I've used it to get several packages to 100% test coverage now. Fantastic.
That said, perhaps I'm missing an option, but I would like to see the ability to only instrument and report the coverage for the top-level package under test (more generally, specifically named packages). There is already a way to exclude packages by name, however, I find myself not wanting to see test coverage for dependencies far more often than I want to see it. Dependencies have their own tests which ensure they work properly.
For an actual example, https://github.com/davecgh/go-spew/spew has 100% test coverage. However, when I run gocov against another package I'm developing right now that makes use of it, it reports coverage not only for the package I'm running it against, but for spew as well. Since the package under test doesn't exercise spew fully (spew has its own tests for that), it dutifully reports low test coverage. I can, of course, exclude the package, but there are several more deps too (all of which have their own tests). This results in a ton of low percentage coverage reports that are largely irrelevant since, in my opinion, it's not the job of a top-level package to test dependencies directly.
I think it would be far easier if there were, at the very least, a flag to ignore imported packages other than the current one under test or specifically named packages on the command line. Best case for me would be to reverse the behavior altogether where gocov only tests (or at least reports) the specific named package(s) unless given a flag to recurse.
The text was updated successfully, but these errors were encountered: