tests/testthat/test-parallel-teardown.R

test_that("teardown error", {
  skip_on_cran()
  skip_on_covr()
  withr::local_envvar(TESTTHAT_PARALLEL = "TRUE")
  err <- tryCatch(
    capture.output(suppressMessages(testthat::test_local(
      test_path("test-parallel", "teardown"),
      reporter = "summary"
    ))),
    error = function(e) e
  )
  expect_s3_class(err$parent, "callr_error")
  expect_match(
    err$message,
    "At least one parallel worker failed to run teardown"
  )
  expect_match(
    err$parent$parent$parent$message,
    "Error in teardown",
    fixed = TRUE
  )
})

Try the testthat package in your browser

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

testthat documentation built on Nov. 25, 2025, 5:09 p.m.