Skip to content

Instantly share code, notes, and snippets.

@czeildi
Last active August 22, 2017 08:24
Show Gist options
  • Save czeildi/c64471b60d90346f18b4eb396b816bc8 to your computer and use it in GitHub Desktop.
Save czeildi/c64471b60d90346f18b4eb396b816bc8 to your computer and use it in GitHub Desktop.
code coverage with covr for a project which is not an R package
# open Rproj with packrat
# restart R session
library("testthat")
source("libraries.R")
packrat::with_extlib(
c("rex", "covr", "DT"), {
library("rex")
library("covr")
library("DT")
covr::shine(covr::file_coverage(
list.files("src", full.names = TRUE),
list.files("test", full.names = TRUE)
), file = file.path(tempdir(), "code_coverage_report.html"))
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment