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()
}

Try the pak package in your browser

Any scripts or data that you put into this service are public.

pak documentation built on May 29, 2024, 10:35 a.m.