Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TealAppDriver skips tests when shinytest2 or rvest are not installed #1432

Merged
merged 7 commits into from
Dec 20, 2024
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) {
averissimo marked this conversation as resolved.
Show resolved Hide resolved
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
Loading