Skip to content

Instantly share code, notes, and snippets.

@jakubsob
Created December 11, 2024 08:08
Show Gist options
  • Save jakubsob/02273a0b502fd20ac260bcf751eb8068 to your computer and use it in GitHub Desktop.
Save jakubsob/02273a0b502fd20ac260bcf751eb8068 to your computer and use it in GitHub Desktop.
Run testthat tests with a filter argument as the first one and allow running in parallel using a flag
.test_file <- function(file = NULL, use_parallel = FALSE) {
if (use_parallel) {
testthat::with_mocked_bindings(
devtools::test(filter = file),
find_parallel = function(...) {
TRUE
},
.package = "testthat"
)
}
devtools::test(filter = file)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment