Skip to content

Commit

Permalink
feat: TealAppDriver skips tests when shinytest2 or rvest are not inst…
Browse files Browse the repository at this point in the history
…alled
  • Loading branch information
averissimo committed Dec 18, 2024
1 parent c57d6de commit 8541273
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions R/TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
TealAppDriver <- R6::R6Class( # nolint: object_name.
"TealAppDriver",
inherit = {
if (!requireNamespace("shinytest2", quietly = TRUE)) {
stop("Please install 'shinytest2' package to use this class.")
}
if (!requireNamespace("rvest", quietly = TRUE)) {
stop("Please install 'rvest' package to use this class.")
}
lapply(c("shinytest2", "rvest"), function(.x, use_testthat) {
if (!requireNamespace(.x, quietly = TRUE)) {
if (use_testthat) {
testthat::skip(sprintf("%s is not installed", .x))
} else {
stop("Please install '", .x, "' package to use this class.", call. = FALSE)
}
}
}, use_testthat = requireNamespace("testthat", quietly = TRUE) && testthat::is_testing())
shinytest2::AppDriver
},
# public methods ----
Expand Down

0 comments on commit 8541273

Please sign in to comment.