This function calculates the test coverage for a development package on the
path. By default it runs only the package tests, but it can also run
vignette and example code.
package_coverage(path = ".", type = c("tests", "vignettes", "examples", "all", "none"), combine_types = TRUE, relative_path = TRUE, quiet = TRUE, clean = TRUE, line_exclusions = NULL, function_exclusions = NULL, code = character(), ..., exclusions)
file path to the package.
run the package ‘tests’, ‘vignettes’, ‘examples’, ‘all’, or ‘none’. The default is ‘tests’.
whether to output the paths as relative or absolute paths.
whether to load and compile the package quietly, useful for debugging errors.
whether to clean temporary output files after running, mainly useful for debugging errors.
a named list of files with the lines to exclude from each file.
a vector of regular expressions matching function
names to exclude. Example
A character vector of additional test code to run.
Additional arguments passed to
‘Deprecated’, please use ‘line_exclusions’ instead.
This function uses
tools::testInstalledPackage() to run the
code, if you would like to test your package in another way you can set
type = "none" and pass the code to run as a character vector to the
exclusions() For details on excluding parts of the
package from the coverage calculations.