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

devtools::test_coverage() reports coverage but covr::package_coverage() &report() reports 0.00% coverage #466

Closed
mccroweyclinton-EPA opened this issue Mar 29, 2021 · 2 comments

Comments

@mccroweyclinton-EPA
Copy link

Good morning, I have created a fairly new package and I am currently cleaning it up. As part of this process I am utilizing covr to manage unit testing. For some reason devtools::package_coverage() seems to accurately report unit test coverage but covr::package_coverage() and covr::report() reports 0.00% coverage. This is confusing to me since the devtools::test_coverage() documentation states that it is simply a wrapper around covr::package_coverage() and covr::report(). My package, for reprex, can be found here.

@jimhester
Copy link
Member

jimhester commented Mar 29, 2021

All of your tests have testthat::skip_on_cran() in them. covr::package_coverage() runs the tests as in the exact same way that CRAN does, e.g. it has no knowledge of devtools or testthat. In particular it does not set the NOT_CRAN environment variable, which is how testthat / devtools denotes if a test is running 'on CRAN' or not.

run Sys.setenv(NOT_CRAN = "true") before calling covr::package_coverage() or covr::report() if you want these tests to run.

@mccroweyclinton-EPA
Copy link
Author

mccroweyclinton-EPA commented Mar 29, 2021

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