Skip to content

Commit e9c96e4

Browse files
yutannihilationthomasp85
authored andcommitted
Fix CI by skipping visual tests when vdiffr is not available (#4192)
* Skip visual tests when vdiffr is not available * Add tweak to skip ggsave tests * Update CMD-ckeck.yml * Add http-user-agent * Fix a comment * Require vdiffr except when it's explicitly disabled
1 parent d9c902b commit e9c96e4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/testthat/helper-vdiffr.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@
22
# - VDIFFR_RUN_TESTS is "false" (on Travis CI with older versions and dev version of R)
33
# - CI is not set (on CRAN)
44

5-
expect_doppelganger <- vdiffr::expect_doppelganger
5+
if (requireNamespace("vdiffr", quietly = TRUE)) {
6+
expect_doppelganger <- vdiffr::expect_doppelganger
7+
} else {
8+
# If vdiffr is not available and visual tests are not explicitly disabled, raise error.
9+
if (!identical(Sys.getenv("VDIFFR_RUN_TESTS"), "false")) {
10+
abort("vdiffr is not installed")
11+
}
12+
13+
# Otherwise, assign a dummy function
14+
expect_doppelganger <- function(...) skip("vdiffr is not installed.")
15+
}

0 commit comments

Comments
 (0)