diff --git a/tests/testthat/test-examples.R b/tests/testthat/test-examples.R index ac0ed08c2..8adc9f92f 100644 --- a/tests/testthat/test-examples.R +++ b/tests/testthat/test-examples.R @@ -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) @@ -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)