Skip to content

Commit

Permalink
feat: stop R process after AppDriver fails
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Dec 16, 2024
1 parent f62391b commit e60e5c8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 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

0 comments on commit e60e5c8

Please sign in to comment.