Skip to content

Commit

Permalink
TealAppDriver skips tests when shinytest2 or rvest are not installed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo authored Dec 20, 2024
1 parent 52cbc4e commit 30ef669
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("testthat", "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 30ef669

Please sign in to comment.