9

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?

jjankowiak
  • 3,010
  • 6
  • 28
  • 45
  • I have had something like this happen as well. Have you looked at the results from `covr::report()`? If so, was it any different? – duckmayr Oct 15 '18 at 10:34
  • Also, is your package source code publicly available, for example in a GitHub repo? – duckmayr Oct 15 '18 at 10:59

1 Answers1

10

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.

jjankowiak
  • 3,010
  • 6
  • 28
  • 45