I'm trying to run a test coverage report on my project which contains several directories (I'm aware this is an unusual setup but it has lots of examples which I want to group together):
└── example
├── bar
│ └── main.go
├── baz
│ └── main.go
├── foo
│ ├── main.go
│ └── main_test.go
└── qux
└── main.go
However when it run I get some strange output. The coverage percentage seems to only related to the only tested file - not the entire codebase under example
.
For instance:
$ go test -race -v -coverprofile .test-coverage.txt ./...
? github.com/abcdef/example/bar [no test files]
? github.com/abcdef/example/baz [no test files]
=== RUN TestSum
--- PASS: TestSum (0.00s)
PASS
coverage: 50.0% of statements
ok github.com/abcdef/example/foo 1.018s coverage: 50.0% of statements
? github.com/abcdef/example/qux [no test files]
Does anyone know why this is happening and whether there's a way I can make it generate a percentage coverage across all files, including any untested files? Otherwise the coverage percentage is completely misleading.
Aucun commentaire:
Enregistrer un commentaire