I have built a package with unit tests for most of the functions. The package has a standard structure:
package:
- R/
- file1.R
- file2.R
- ...
- tests/
- testthat/
- tests_for_file1.R
- tests_for_file2.R
- ...
- ...
Calling a function devtools::check()
in R console gives me no errors
R CMD check results
0 errors | 1 warning | 1 note
Calling a function devtools::test()
is also successful
OK: 72
Failed: 0
Warnings: 0
Skipped: 0
However covr::package_coverage()
give me this result
package Coverage: 0.00%
R/file1.R: 0.00%
R/file2.R: 0.00%
...
Why?
I found the answer to the problem here
I was missing package/tests/testthat.R
file, which can be set up with usethis::use_testthat()
and usethis::use_test()
. It helped me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With