filecovRunit is a small R-package which extends the file_coverage()-function from R's covr-Package.
devtools::install_github("simschul/filecovRunit")
Load test data. One source file (src) which contains functions to be tested, and one test file containing Runit-tests.
src <- c(system.file(file.path("extdata", "functions.R"), package = "filecovrunit"),
system.file(file.path("extdata", "functions2.R"), package = "filecovrunit"))
test <- c(system.file(file.path("extdata", "test_1.R"), package = "filecovrunit"),
system.file(file.path("extdata", "test_2.R"), package = "filecovrunit"))
Now let's check the code coverage of the files:
cov <- filecovrunit::file_coverage_runit(source_files = src, test_files = test, load_package = FALSE)
cov
covr::report(cov)
filecovrunit::zero_coverage(cov)