Skip to content

Commit

Permalink
Stop R process if AppDriver fails in test-examples (#1303)
Browse files Browse the repository at this point in the history
# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Fixes #1302
  • Loading branch information
averissimo authored Dec 17, 2024
1 parent f62391b commit eb860e9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/testthat/test-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ with_mocked_app_bindings <- function(code) {
args <- list(...)
args[["launch.browser"]] <- FALSE # needed for RStudio

app_driver <- shinytest2::AppDriver$new(
x,
shiny_args = args,
check_names = FALSE, # explicit check below
options = options() # https://github.com/rstudio/shinytest2/issues/377
app_driver <- tryCatch(
shinytest2::AppDriver$new(
x,
shiny_args = args,
check_names = FALSE, # explicit check below
options = options() # https://github.com/rstudio/shinytest2/issues/377
),
error = function(e) {
e$app$stop() # Ensure the R instance is stopped
stop(e)
}
)
on.exit(app_driver$stop(), add = TRUE)
app_driver$wait_for_idle(timeout = 20000)
Expand Down Expand Up @@ -118,6 +124,7 @@ for (i in rd_files()) {
paste0("example-", basename(i)),
{
testthat::skip_on_cran()
skip_if_too_deep(5)
if (basename(i) %in% strict_exceptions) {
op <- options()
withr::local_options(opts_partial_match_old)
Expand Down

0 comments on commit eb860e9

Please sign in to comment.