Skip to content

Commit 0d8370d

Browse files
committed
Skip snapshots on old R versions
1 parent e6380a3 commit 0d8370d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22
# vdiffr (development version)
33

4+
- Following an update to the graphics engine of R 4.1.0 that causes
5+
spurious failures due to subtle changes in graphics generation,
6+
vdiffr snapshots are now skipped on old versions of R. The plots are
7+
still generated on all versions so any errors during plot drawing
8+
will be detected by testthat.
9+
410
- The SVG generation engine of vdiffr has been updated (@thomasp85).
511
Font sizes are now precomputed for the first 50000 unicode points.
612
This allows deterministic computation of text box extents without

R/testthat-ui.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ expect_doppelganger <- function(title,
136136
testcase <- make_testcase_file(fig_name)
137137
writer(fig, testcase, title)
138138

139+
if (getRversion() < "4.1.0") {
140+
testthat::skip(paste_line(
141+
"The R graphics engine is too old.",
142+
"Please update to R 4.1.0 and regenerate the vdiffr snapshots."
143+
))
144+
}
145+
139146
context <- get(".context", envir = testthat::get_reporter())
140147
context <- str_standardise(context %||% "")
141148
path <- path %||% context
@@ -224,7 +231,10 @@ match_exp <- function(msg, case) {
224231
}
225232
mismatch_exp <- function(msg, case) {
226233
if (is_vdiffr_stale()) {
227-
msg <- "The vdiffr engine is too old. Please update vdiffr and revalidate the figures."
234+
msg <- paste_line(
235+
"The vdiffr engine is too old.",
236+
"Please update vdiffr and regenerate the snapshots."
237+
)
228238
new_expectation(msg, case, "skip", "vdiffr_mismatch")
229239
} else if (is_ci()) {
230240
new_expectation(msg, case, "failure", "vdiffr_mismatch")

0 commit comments

Comments
 (0)