vdiffr icon indicating copy to clipboard operation
vdiffr copied to clipboard

`VDIFFR_RUN_TESTS` environment setting

Open jtlandis opened this issue 1 year ago • 5 comments

I have an R package that is consistently failing GHA for Linux r: devel. I was trying to follow ggplot2's github actions workflow yaml to skip tests based on the version of r, but for some reason it doesn't seem that any of the tests are skipped. I also did a quick grep in the code and I didn't find any instance of when "VDIFFR_RUN_TESTS" in the code anymore. It seems like it was once apart of the code base, but not anymore

Am I missing something?

jtlandis avatar Feb 26 '24 00:02 jtlandis

I can confirm that setting the following in the testthat.R file has helped skip vdiffr tests on CI.

if ((nzchar(Sys.getenv("CI")) ||
     !nzchar(Sys.getenv("NOT_CRAN"))) &&
    identical(Sys.getenv("VDIFFR_RUN_TESTS"), 'false')) {
  #if we are running tests remotely AND
  # we are opting out of using vdiffr
  # assigning a dummy function

  expect_doppelganger <- function(...) {
    testthat::skip("`VDIFFR_RUN_TESTS` set to false on this remote check")
  }
} else {
  expect_doppelganger <- vdiffr::expect_doppelganger
}

jtlandis avatar Feb 26 '24 00:02 jtlandis