tests/testthat/helper-vcr.R

library("vcr") # *Required* as vcr is set up on loading

vcr_dir <- system.file("_vcr", package = "notionapi")

invisible(
  vcr::vcr_configure(
    dir = vcr_dir
  )
)

if (!nzchar(Sys.getenv("NOTION_TOKEN"))) {
  if (dir.exists(vcr_dir)) {
    Sys.setenv("NOTION_TOKEN" = "foo")
  } else {
    stop("No API key nor cassettes, tests cannot be run.", call. = FALSE)
  }
}

Try the notionapi package in your browser

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

notionapi documentation built on April 13, 2026, 9:07 a.m.