Skip to content

Commit 7346b09

Browse files
schloerkehadley
andauthored
Fix broken shinytest2 infrastructure (#2294)
Fixes #2293 Fixes #2288 --------- Co-authored-by: Hadley Wickham <[email protected]>
1 parent d880776 commit 7346b09

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# testthat (development version)
22

3+
* Fixed support for `shinytest2::AppDriver$expect_values()` screenshot snapshot failing on CI (#2293, #2288).
4+
35
# testthat 3.3.0
46

57
## Lifecycle changes

R/expectation.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ exp_signal <- function(exp) {
104104
} else {
105105
signalCondition(exp)
106106
},
107-
muffle_expectation = function(e) NULL
107+
muffle_expectation = function(e) NULL,
108+
# Legacy support for shinytest2
109+
# https://github.com/r-lib/testthat/pull/2271#discussion_r2528722708
110+
continue_test = function(e) NULL
108111
)
109112

110113
invisible(exp)

R/snapshot-file.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,11 @@ snapshot_file_equal <- function(
261261
# We want to fail on CI since this suggests that the user has failed
262262
# to record the value locally
263263
if (fail_on_new) {
264-
return(snapshot_fail(message, trace_env = trace_env))
264+
snapshot_fail(message, trace_env = trace_env)
265+
} else {
266+
testthat_warn(message)
265267
}
266-
testthat_warn(message)
268+
267269
TRUE
268270
}
269271
}

R/test-that.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ test_code <- function(code, env, reporter = NULL, skip_on_empty = TRUE) {
110110
}
111111
handle_expectation <- function(e) {
112112
the$test_expectations <- the$test_expectations + 1L
113-
register_expectation(e, 7)
113+
register_expectation(e, 11)
114114
invokeRestart("muffle_expectation")
115115
}
116116
handle_warning <- function(e) {

0 commit comments

Comments
 (0)