Skip to content

Toggle the logic of skipping visual tests #4310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/testthat/helper-vdiffr.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# vdiffr ignores failures when
# - VDIFFR_RUN_TESTS is "false" (on Travis CI with older versions and dev version of R)
# - CI is not set (on CRAN)
# By default, if vdiffr is not installed, all visual tests are skipped unless
# VDIFFR_RUN_TESTS is explicitly set to "true", which should be the case only on
# a GitHub Actions CI runner with stable version of R.

if (requireNamespace("vdiffr", quietly = TRUE)) {
expect_doppelganger <- vdiffr::expect_doppelganger
} else {
# If vdiffr is not available and visual tests are not explicitly disabled, raise error.
if (!identical(Sys.getenv("VDIFFR_RUN_TESTS"), "false")) {
# If vdiffr is not available and visual tests are explicitly required, raise error.
if (identical(Sys.getenv("VDIFFR_RUN_TESTS"), "true")) {
abort("vdiffr is not installed")
}

Expand Down