tests/testthat/test-build-manual.R

test_that("build_manual() shows stderr on failure", {
  skip_on_os("windows")

  pkg <- local_package_create()
  pkg <- normalizePath(pkg)

  # Too hard to replicate actual error, so we just simulate
  local_mocked_bindings(rd2pdf = function(...) {
    stderr <- "! LaTeX Error: File `inconsolata.sty' not found."
    abort("System command 'R' failed", stderr = stderr) #nolint
  })

  expect_snapshot(build_manual(pkg), error = TRUE, transform = function(x) {
    x <- gsub(pkg, "<pkgdir>", x, fixed = TRUE)
    x
  })
})

Try the devtools package in your browser

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

devtools documentation built on March 14, 2026, 5:06 p.m.