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

plz cover only works when a target is explicitly specified... #535

Closed
sean- opened this issue Jan 16, 2019 · 2 comments
Closed

plz cover only works when a target is explicitly specified... #535

sean- opened this issue Jan 16, 2019 · 2 comments

Comments

@sean-
Copy link
Contributor

sean- commented Jan 16, 2019

This took me a while to figure out.

% plz cover
[snip]
31 test targets and 237 tests run in 0s; 209 passed, 28 skipped. Total time 3.44s.
Coverage results:
Total coverage:  No data
% plz cover //foo/bar:bar_test
[snip]
//foo/bar:bar_test 59 tests run in 34ms; 59 passed
1 test target and 59 tests run in 0s; 59 passed. Total time 540ms.
Coverage results:
foo/bar:
  file1.go 0/10 lines, 0.0%
  file2.go 3/39 lines, 7.7%
  file3.go 97/107 lines, 90.7%
Total coverage:  100/156 lines, 64.1%
% plz cover
[snip]
31 test targets and 237 tests run in 0s; 209 passed, 28 skipped. Total time 3.42s.
Coverage results:
foo/bar:
  file1.go 0/10 lines, 0.0%
  file2.go 3/39 lines, 7.7%
  file3.go 97/107 lines, 90.7%
Total coverage:  100/156 lines, 64.1%
% plz cover //...
31 test targets and 237 tests run in 0s; 209 passed, 28 skipped. Total time 2m32.3s.
Coverage results:
[snip]
Total coverage:  12076/16719 lines, 72.2%
% plz cover --nocache
[snip]
31 test targets and 237 tests run in 0s; 209 passed, 28 skipped. Total time 4.25s.
Coverage results:
Total coverage:  No data

Wait, what? ;)

To take this one step further:

% cd foo/bar
% plz cover
//foo/bar:bar_test 59 tests run in 35ms; 59 passed
1 test target and 59 tests run in 0s; 59 passed. Total time 3.03s.
Coverage results:
foo/bar:
  file1.go 0/25 lines, 0.0%
  file2.go 0/78 lines, 0.0%
  file3.go 0/201 lines, 0.0%
Total coverage:  0/304 lines, 0.0%
% plz cover //foo/bar:bar_test
//foo/bar:bar_test 59 tests run in 31ms; 59 passed
[snip test output]
31 test targets and 237 tests run in 0s; 209 passed, 28 skipped. Total time 3.42s.
Coverage results:
foo/bar:
  file1.go 0/10 lines, 0.0%
  file2.go 3/39 lines, 7.7%
  file3.go 97/107 lines, 90.7%
Total coverage:  100/156 lines, 64.1%

I'm really confused by this output as I expect plz cover to produce coverage information without explicitly adding the //... target. Similarly, having it implicitly include stale coverage data is a bit disturbing. If I manually add random tests via plz cover //targetN, plz cover reports the results. I also expect it to run the coverage tests when I'm in a subdirectory. Thoughts?

@peterebden
Copy link
Member

Sorry for the slow reply on this one... it should work as you describe. There's a fairly dumb bug around it not producing coverage when no target is given on the command line, but found a few other things while digging too.

@sean-
Copy link
Contributor Author

sean- commented Apr 28, 2019

No worries, sorry for being late to thank you for this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants