tests/testthat/test-reporter-slow.R

test_that("multiplication works", {
  n_tests <- function(n) {
    for (i in 1:n) {
      test_that(paste0("run ", i), {
        suceed()
      })
    }
  }
  expect_snapshot(
    {
      show_all <- SlowReporter$new(min_time = 0)
      with_reporter(show_all, n_tests(10))
    },
    transform = \(x) gsub("\\d.\\d\\ds", "-.--s", x),
  )
})

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.