Skip to contents

When examining the test coverage of a package, it is useful to know if there are any locations where there is 0 test coverage.

Usage

zero_coverage(x, ...)

Arguments

x

a coverage object returned package_coverage()

...

additional arguments passed to tally_coverage(), such as by = "function" to list the functions that were never run.

Value

A data.frame with coverage data where the coverage is 0.

Details

if used within RStudio this function outputs the results using the Marker API.

Examples

cov <- code_coverage(
  "f <- function(x) {\n  if (x) 'yes' else 'no'\n}\ng <- function() 1",
  "f(TRUE)"
)
zero_coverage(cov)
#>                               filename functions line value
#> 1 /tmp/RtmpvpKgL4/source.R190e50d1ff5a         f    2     0
#> 2 /tmp/RtmpvpKgL4/source.R190e50d1ff5a         g    4     0
zero_coverage(cov, by = "function")
#>                               filename functions first_line last_line value
#> 2 /tmp/RtmpvpKgL4/source.R190e50d1ff5a         g          4         4     0