Skip to content

Commit b6676ab

Browse files
committed
Tweak blank lines/skips in CompactProgressReporter
1 parent 358a340 commit b6676ab

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

R/reporter-progress.R

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,25 @@ CompactProgressReporter <- R6::R6Class("CompactProgressReporter",
345345
self$cat_tight(paste(summary, collapse = "\n\n"))
346346

347347
self$cat_line()
348-
self$cat_line()
349348
},
350349

351350
end_reporter = function() {
352-
skip_report(self)
351+
had_feedback <- self$n_fail > 0 || self$n_warn > 0
352+
353+
if (self$n_skip > 0) {
354+
if (!had_feedback) {
355+
self$cat_line()
356+
}
357+
self$cat_line()
358+
skip_report(self)
359+
}
353360

354-
if (self$n_fail > 0 || self$n_warn > 0 || self$n_skip > 0) {
361+
if (had_feedback) {
355362
self$show_status()
356363
self$cat_line()
357364
} else if (self$is_full()) {
358365
self$cat_line(" Terminated early")
359-
} else if (!self$rstudio) {
366+
} else if (self$n_skip == 0 && !self$rstudio) {
360367
self$cat_line(cli::style_bold(" Done!"))
361368
}
362369
},

tests/testthat/_snaps/reporter-progress.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@
353353
1. \-f()
354354
2. \-testthat::expect_true(FALSE)
355355

356-
357356
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 1 ]
358357
[ FAIL 3 | WARN 0 | SKIP 0 | PASS 1 ]
359358
[ FAIL 4 | WARN 0 | SKIP 0 | PASS 1 ]
@@ -369,7 +368,6 @@
369368
2. \-g()
370369
3. \-h()
371370

372-
373371
[ FAIL 4 | WARN 0 | SKIP 0 | PASS 1 ]
374372
[ FAIL 4 | WARN 0 | SKIP 1 | PASS 1 ]
375373
[ FAIL 4 | WARN 0 | SKIP 2 | PASS 1 ]
@@ -404,6 +402,20 @@
404402
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 6 ]
405403
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 7 ] Done!
406404

405+
---
406+
407+
408+
== Testing reporters/skips.R ===================================================
409+
410+
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ]
411+
[ FAIL 0 | WARN 0 | SKIP 1 | PASS 0 ]
412+
[ FAIL 0 | WARN 0 | SKIP 2 | PASS 0 ]
413+
414+
-- Skipped tests (2) -----------------------------------------------------------
415+
* longer skip (1): 'reporters/skips.R:6:3'
416+
* regular skip (1): 'reporters/skips.R:2:3'
417+
418+
407419
---
408420

409421

tests/testthat/test-reporter-progress.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ test_that("display of successes only is compact", {
7171
test_path("reporters/successes.R")
7272
)
7373

74+
expect_snapshot_reporter(
75+
CompactProgressReporter$new(),
76+
test_path("reporters/skips.R")
77+
)
78+
7479
# And even more compact if in RStudio pane
7580
local_reproducible_output(rstudio = TRUE)
7681
expect_snapshot_reporter(

0 commit comments

Comments
 (0)