Skip to content

Commit 367b2ce

Browse files
committed
Use SHINYTEST2_APP_DRIVER_TEST_ON_CRAN sys env escape hatch
1 parent 071970b commit 367b2ce

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

R/app-driver-initialize.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,16 @@ app_initialize <- function(self, private, ..., view = missing_arg()) {
202202
#
203203
# However, we can not use it conditionally.
204204
# So the only course of action is to skip the test.
205-
testthat::skip_on_cran()
205+
206+
# If sys envvar `SHINYTEST2_APP_DRIVER_TEST_ON_CRAN` is "true" or "1",
207+
# then do not skip testing on CRAN
208+
env_test_on_cran <- Sys.getenv("SHINYTEST2_APP_DRIVER_TEST_ON_CRAN", "false")
209+
should_test_on_cran <- lower(env_test_on_cran) %in% c("true", "1")
210+
should_skip_on_cran <- !should_test_on_cran
211+
if (should_skip_on_cran) {
212+
# 99% Common case: Skip test on CRAN where chromote is used
213+
testthat::skip_on_cran()
214+
}
206215

207216
if (testthat::is_testing()) {
208217
# Make sure chromote can be started. If not, skip test

0 commit comments

Comments
 (0)