Skip to content

Instantly share code, notes, and snippets.

@randrescastaneda
Created January 19, 2024 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randrescastaneda/9d69b5d02f6f20a2101348198167b763 to your computer and use it in GitHub Desktop.
Save randrescastaneda/9d69b5d02f6f20a2101348198167b763 to your computer and use it in GitHub Desktop.
Check coverage of file when `test_coverage_active_file()` does not find Rds files in tests
alt_coverage <- function(file_name = devtools:::find_active_file() |>
fs::path_file(),
report = TRUE) {
rf <- fs::path("R", file_name)
tf <- "tests/testthat" |>
fs::path(paste0("test-", file_name))
dd <- covr::file_coverage(source_files = rf,
test_files = tf)
if (report == TRUE) {
covr::report(dd)
}
dd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment