Examples for 'testthat::Reporter'


Manage test reporting

Aliases: Reporter

Keywords: internal

### ** Examples

path <- testthat_example("success")

test_file(path)
══ Testing test-success.R ══════════════════════════════════════════════════════

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ]
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
[ FAIL 1 | WARN 0 | SKIP 1 | PASS 0 ]
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 0 ]
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 1 ]
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 2 ]
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 3 ]

── Error (test-success.R:2:3): one plus one is two ─────────────────────────────
Error in `get(genname, envir = envir)`: object 'compare_proxy' not found
Backtrace:
  1. testthat::expect_equal(1 + 1, 2)
       at test-success.R:2:3
  4. base::loadNamespace(x)
  7. base::loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
  8. base::registerS3methods(nsInfo$S3methods, package, env)
  9. base (local) register_S3_method_delayed(pkg, gen, cls, fun)
 10. base::registerS3method(gen, cls, fun, envir = asNamespace(pkg))
 11. base::get(genname, envir = envir)

── Skip (test-success.R:6:3): you can skip tests if needed ─────────────────────
Reason: This test hasn't been written yet

── Warning (test-success.R:10:3): some tests have warnings ─────────────────────
NaNs produced
Backtrace:
 1. testthat::expect_equal(log(-1), NaN)
      at test-success.R:10:3
 2. testthat::quasi_label(enquo(object), label, arg = "object")
 3. rlang::eval_bare(expr, quo_get_env(quo))


[ FAIL 1 | WARN 1 | SKIP 1 | PASS 3 ]
No deferred expressions to run
# Override the default by supplying the name of a reporter
test_file(path, reporter = "minimal")
.SW...
No deferred expressions to run

[Package testthat version 3.1.4 Index]