From 66a68800c02fdd11fec004ef2991779d2660fa3e Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 6 Jan 2022 22:58:05 -0600 Subject: [PATCH] In CheckReporter, also display summary at top This is useful when look at the full results in CI --- R/reporter-check.R | 8 ++++++++ tests/testthat/_snaps/reporter-check.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/R/reporter-check.R b/R/reporter-check.R index 05fc42b2e..6e836f49d 100644 --- a/R/reporter-check.R +++ b/R/reporter-check.R @@ -35,6 +35,14 @@ CheckReporter <- R6::R6Class("CheckReporter", }, end_reporter = function() { + self$cat_line(summary_line( + n_fail = self$problems$size(), + n_warn = self$warnings$size(), + n_skip = self$skips$size(), + n_pass = self$n_ok + )) + self$cat_line() + if (self$skips$size() > 0) { self$rule("Skipped tests", line = 2) self$cat_line(skip_bullets(self$skips$as_list())) diff --git a/tests/testthat/_snaps/reporter-check.md b/tests/testthat/_snaps/reporter-check.md index c21d37e23..c5bf12468 100644 --- a/tests/testthat/_snaps/reporter-check.md +++ b/tests/testthat/_snaps/reporter-check.md @@ -1,5 +1,7 @@ # basic report works + [ FAIL 4 | WARN 1 | SKIP 3 | PASS 1 ] + == Skipped tests =============================================================== * empty test (2) * skip (1) @@ -39,6 +41,8 @@ # doesn't truncate long lines + [ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ] + == Failed tests ================================================================ -- Failure (long-test.R:2:3): That very long test messages are not truncated because they contain useful information that you probably want to read -- Failure has been forced @@ -48,9 +52,13 @@ # always shows summary [ FAIL 0 | WARN 0 | SKIP 0 | PASS 7 ] + + [ FAIL 0 | WARN 0 | SKIP 0 | PASS 7 ] # shows warnings when not on CRAN + [ FAIL 4 | WARN 1 | SKIP 3 | PASS 1 ] + == Skipped tests =============================================================== * empty test (2) * skip (1)