if (FALSE) {
# ./tests/testthat/apps/myapp/R/utils.R
n <- 42
#' # ./tests/testthat/test-utils.R
test_that("Can access support environment", {
expect_false(exists("n"))
shinytest2::local_app_support(test_path("apps/myapp"))
expect_equal(n, 42)
})
# Or using with_app_support()
test_that("Can access support environment", {
expect_false(exists("n"))
shinytest2::with_app_support(test_path("apps/myapp"), {
expect_equal(n, 42)
})
expect_false(exists("n"))
})
}
Run the code above in your browser using DataLab