@jpritikin That is strange that the estimates are so different. I'm not sure exactly what could be causing that.
Based on the arguments to tally_coverage(), which is called by percent_coverage(), I think the default behavior is by "line".
args(covr::tally_coverage)
## function (x, by = c("line", "expression"))
## NULL
What do you get when you set by = "expression"?
For my package, I get very similar estimates for line and expression, but the Codecov estimate of 83.74% is closer to the default line coverage reported by covr when run on my local machine.
library(covr)
cov <- package_coverage()
percent_coverage(cov)
## [1] 83.77545
percent_coverage(cov, by = "line")
## [1] 83.77545
percent_coverage(cov, by = "expression")
## [1] 83.84679
Also, a general note on forums: it is best practice to link to any other forums where you previously asked the question. The first thing I did after reading your question was to go to the GitHub Issues for covr, where I found your question and Jim's response:
codecov is reporting coverage per line, covr is reporting coverage per expression. See ?tally_coverage .
@jimhester Based on tally_coverage(), it appears that covr also reports line coverage by default. Could you please elaborate on your explanation? Thanks!