tests/testthat.R

do <- function() {
  old <- Sys.getenv("R_PKG_CACHE_DIR", NA_character_)
  if (is.na(old)) {
    on.exit(Sys.unsetenv("R_PKG_CACHE_DIR"), add = TRUE)
  } else {
    on.exit(Sys.setenv("R_PKG_CACHE_DIR" = old), add = TRUE)
  }
  Sys.setenv("R_PKG_CACHE_DIR" = tempfile())

  library(pak)
  library(testthat)
  test_check("pak", reporter = "summary")
}

if (Sys.getenv("NOT_CRAN") == "true") {
  do()
}
r-lib/pak documentation built on Nov. 9, 2024, 2:34 a.m.