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

Coverage not reported when -coverpkg flag is used #189

Closed
heppu opened this issue Apr 15, 2021 · 1 comment · Fixed by #190
Closed

Coverage not reported when -coverpkg flag is used #189

heppu opened this issue Apr 15, 2021 · 1 comment · Fixed by #190
Labels
bug Something isn't working

Comments

@heppu
Copy link

heppu commented Apr 15, 2021

When -cover flag is used the coverage is reported correctly:

$ gotestsum -- -cover ./...
✓  . (2ms) (coverage: 0.0% of statements)
✓  killer (11ms) (coverage: 12.9% of statements)

DONE 2 tests in 0.340s

However if I add -coverpkg flag the coverage is not reported anymore:

$ gotestsum -- -cover -coverpkg ./killer ./...
✓  killer (10ms)
✓  . (2ms)

DONE 2 tests in 0.180s

Same commands with go test as reference:

$ go test -cover ./...                                                                                                             
ok  	github.com/heppu/gkill	0.001s	coverage: 0.0% of statements
ok  	github.com/heppu/gkill/killer	0.005s	coverage: 12.9% of statements

$ go test -cover -coverpkg=./... ./...
ok  	github.com/heppu/gkill	(cached)	coverage: 0.0% of statements in ./...
ok  	github.com/heppu/gkill/killer	(cached)	coverage: 12.1% of statements in ./...

Version info:

$ go version -m $(which gotestsum)
/home/heppu/go/bin/gotestsum: go1.16.3
	path	gotest.tools/gotestsum
	mod	gotest.tools/gotestsum	v1.6.3	h1:E3wOF4wmxKA19BB5wTY7t0L1m+QNARtDcBX4yqG6DEc=
	dep	github.com/dnephin/pflag	v1.0.7	h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk=
	dep	github.com/fatih/color	v1.10.0	h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
	dep	github.com/fsnotify/fsnotify	v1.4.9	h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
	dep	github.com/google/shlex	v0.0.0-20191202100458-e7afc7fbc510	h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
	dep	github.com/jonboulle/clockwork	v0.2.2	h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
	dep	github.com/mattn/go-colorable	v0.1.8	h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
	dep	github.com/mattn/go-isatty	v0.0.12	h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
	dep	github.com/pkg/errors	v0.9.1	h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
	dep	golang.org/x/crypto	v0.0.0-20200622213623-75b288015ac9	h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
	dep	golang.org/x/mod	v0.3.0	h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
	dep	golang.org/x/sync	v0.0.0-20201020160332-67f06af15bc9	h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
	dep	golang.org/x/sys	v0.0.0-20210119212857-b64e53b001e4	h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
	dep	golang.org/x/tools	v0.1.0	h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
	dep	golang.org/x/xerrors	v0.0.0-20200804184101-5ec99f83aff1	h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
@dnephin dnephin added the bug Something isn't working label Apr 17, 2021
@dnephin
Copy link
Member

dnephin commented Apr 17, 2021

Thank you for the bug report! It looks like the check for coverage output was a little too strict. I did not realize there were other outputs that did not match. #190 should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants