1

I'm trying to run a test coverage report on a project. When I run go test ./... -count=1 at the root of my project it lists all the namespaces as they're testing. For this project it looks something like this:

?       some/namespace  [no test files]
?       some/namespace/A    [no test files]
?       some/namespace/B    [no test files]
ok      some/namespace/util 0.260s  coverage: 100.0% of statements

However when I run go test ./... -coverprofile=coverage.out it only produces lines for my util package and the final line at the bottom shows a test coverage of 100%. While I did get 100% of that namespace covered, I would expect that if I ask for test coverage of an entire project that the total percentage would include packages that don't have tests.

How can I get a proper percentage of test coverage for my whole project?

Corey Ogburn
  • 24,072
  • 31
  • 113
  • 188

1 Answers1

1

try to use additional flags:

go test ./... -covermode=atomic -coverprofile=coverage.out -coverpkg=./...

Alexey Sudachen
  • 364
  • 2
  • 5