tests/testthat/test-shiny.R

test_that("Shiny examples have a shiny dependency", {
  skip_on_cran()
  skip_if_not_installed("shiny")

  # Confirm packrat believes all example shiny apps are, in fact, shiny apps
  examplesPath <- system.file("examples", package = "shiny")
  apps <- list.files(examplesPath, full.names = TRUE)
  for (app in apps) {
    expect_true("shiny" %in% packrat:::appDependencies(app), app)
  }
})

test_that("projects which use shiny implicitly are detected", {
  skip_on_cran()

  # Check that 'shiny' is listed as a dependency for an
  # R Markdown document with 'runtime: shiny'
  interactiveDocPath <- file.path("resources", "interactive-doc-example.Rmd")
  expect_true("shiny" %in% packrat:::fileDependencies(interactiveDocPath))
})

Try the packrat package in your browser

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

packrat documentation built on Jan. 10, 2023, 1:07 a.m.