Skip to content

Commit e4b8747

Browse files
authored
Show all failures when hitting max failures in parallel mode (#2219)
Fixes #2217
1 parent 71a33cd commit e4b8747

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

R/reporter-progress.R

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,10 @@ ProgressReporter <- R6::R6Class(
231231
snapshotter$end_file()
232232
}
233233

234+
# Separate from the progress bar
235+
self$cat_line()
234236
stop_reporter(c(
235-
"Maximum number of failures exceeded; quitting at end of file.",
237+
"Maximum number of failures exceeded; quitting.",
236238
i = "Increase this number with (e.g.) {.run testthat::set_max_fails(Inf)}"
237239
))
238240
},
@@ -462,22 +464,34 @@ ParallelProgressReporter <- R6::R6Class(
462464
},
463465

464466
end_file = function() {
465-
fsts <- self$files[[self$file_name]]
466-
time <- proc.time() - fsts$start_time
467+
if (!self$is_full()) {
468+
fsts <- self$files[[self$file_name]]
469+
time <- proc.time() - fsts$start_time
467470

468-
# Workaround for https://github.com/rstudio/rstudio/issues/7649
469-
if (self$is_rstudio) {
470-
self$cat_tight(strpad(self$cr(), self$width + 1)) # +1 for \r
471-
}
472-
self$show_status(complete = TRUE, time = time[[3]], pad = TRUE)
473-
self$report_issues(fsts$issues)
471+
# Workaround for https://github.com/rstudio/rstudio/issues/7649
472+
if (self$is_rstudio) {
473+
self$cat_tight(strpad(self$cr(), self$width + 1)) # +1 for \r
474+
}
475+
self$show_status(complete = TRUE, time = time[[3]], pad = TRUE)
476+
self$report_issues(fsts$issues)
474477

475-
self$files[[self$file_name]] <- NULL
476-
if (length(self$files)) {
478+
self$files[[self$file_name]] <- NULL
479+
if (length(self$files)) {
480+
self$update(force = TRUE)
481+
}
482+
} else {
477483
self$update(force = TRUE)
478-
}
484+
self$cat_line()
485+
self$rule()
479486

480-
if (self$is_full()) {
487+
issues <- unlist(
488+
map(self$files, \(x) x$issues$as_list()),
489+
recursive = FALSE
490+
)
491+
summary <- map_chr(issues, issue_summary)
492+
self$cat_tight(paste(summary, collapse = "\n\n"))
493+
494+
self$cat_line()
481495
self$report_full()
482496
}
483497
},

tests/testthat/_snaps/reporter-progress.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@
142142
`expected`: TRUE
143143

144144
--------------------------------------------------------------------------------
145-
Maximum number of failures exceeded; quitting at end of file.
145+
146+
Maximum number of failures exceeded; quitting.
146147
i Increase this number with (e.g.) `testthat::set_max_fails(Inf)`
147148

148149
# can fully suppress incremental updates
@@ -573,7 +574,7 @@
573574
v | F W S OK | Context
574575

575576
- [ FAIL 0 | WARN 0 | SKIP 0 | PASS 0 ] Starting up...
576-
x | 11 0 | reporters/fail-many
577+
\ [ FAIL 11 | WARN 0 | SKIP 0 | PASS 0 ] @ reporters/fail-many
577578
--------------------------------------------------------------------------------
578579
Failure ('reporters/fail-many.R:3:5'): Example
579580
Expected FALSE to be TRUE.
@@ -651,8 +652,8 @@
651652
`actual`: FALSE
652653
`expected`: TRUE
653654

654-
--------------------------------------------------------------------------------
655-
Maximum number of failures exceeded; quitting at end of file.
655+
656+
Maximum number of failures exceeded; quitting.
656657
i Increase this number with (e.g.) `testthat::set_max_fails(Inf)`
657658

658659

0 commit comments

Comments
 (0)