diff --git a/NEWS.md b/NEWS.md index 3845257a3..cf5a04b04 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # testthat (development version) +* Fixed support for `shinytest2::AppDriver$expect_values()` screenshot snapshot failing on CI (#2293, #2288). + # testthat 3.3.0 ## Lifecycle changes diff --git a/R/expectation.R b/R/expectation.R index c16b8a1b2..0fc276a65 100644 --- a/R/expectation.R +++ b/R/expectation.R @@ -104,7 +104,10 @@ exp_signal <- function(exp) { } else { signalCondition(exp) }, - muffle_expectation = function(e) NULL + muffle_expectation = function(e) NULL, + # Legacy support for shinytest2 + # https://github.com/r-lib/testthat/pull/2271#discussion_r2528722708 + continue_test = function(e) NULL ) invisible(exp) diff --git a/R/snapshot-file.R b/R/snapshot-file.R index 0106f4bb2..eb9b28719 100644 --- a/R/snapshot-file.R +++ b/R/snapshot-file.R @@ -261,9 +261,11 @@ snapshot_file_equal <- function( # We want to fail on CI since this suggests that the user has failed # to record the value locally if (fail_on_new) { - return(snapshot_fail(message, trace_env = trace_env)) + snapshot_fail(message, trace_env = trace_env) + } else { + testthat_warn(message) } - testthat_warn(message) + TRUE } } diff --git a/R/test-that.R b/R/test-that.R index 4e7fbae92..05f7fb0cd 100644 --- a/R/test-that.R +++ b/R/test-that.R @@ -110,7 +110,7 @@ test_code <- function(code, env, reporter = NULL, skip_on_empty = TRUE) { } handle_expectation <- function(e) { the$test_expectations <- the$test_expectations + 1L - register_expectation(e, 7) + register_expectation(e, 11) invokeRestart("muffle_expectation") } handle_warning <- function(e) {