Skip to content

Commit 510e826

Browse files
committed
Show all failure when hitting max failures in parallel mode
Fixes #2217
1 parent c45ce93 commit 510e826

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed

R/reporter-progress.R

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

234+
# Separate from the progress bar
235+
self$cat_line()
236+
self$cat_line()
234237
stop_reporter(c(
235238
"Maximum number of failures exceeded; quitting at end of file.",
236239
i = "Increase this number with (e.g.) {.run testthat::set_max_fails(Inf)}"
@@ -462,22 +465,31 @@ ParallelProgressReporter <- R6::R6Class(
462465
},
463466

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

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)
472+
# Workaround for https://github.com/rstudio/rstudio/issues/7649
473+
if (self$is_rstudio) {
474+
self$cat_tight(strpad(self$cr(), self$width + 1)) # +1 for \r
475+
}
476+
self$show_status(complete = TRUE, time = time[[3]], pad = TRUE)
477+
self$report_issues(fsts$issues)
474478

475-
self$files[[self$file_name]] <- NULL
476-
if (length(self$files)) {
477-
self$update(force = TRUE)
478-
}
479+
self$files[[self$file_name]] <- NULL
480+
if (length(self$files)) {
481+
self$update(force = TRUE)
482+
}
483+
} else {
484+
self$cat_line()
485+
486+
issues <- unlist(
487+
map(self$files, \(x) x$issues$as_list()),
488+
recursive = FALSE
489+
)
490+
summary <- map_chr(issues, issue_summary)
491+
self$cat_tight(paste(summary, collapse = "\n\n"))
479492

480-
if (self$is_full()) {
481493
self$report_full()
482494
}
483495
},

tests/testthat/_snaps/describe.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# snapshot tests in describe
2-
3-
Code
4-
1 + 1
5-
Output
6-
[1] 2
7-
81
# snapshot tests in describe / and in it
92

103
Code

tests/testthat/test-capture-output.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
test_that("fails", {
2+
for (i in 1:5) {
3+
test_that(paste0(i), fail())
4+
}
5+
})
6+
17
test_that("multiplication works", {
28
utf8 <- "M\u00e4chler"
39
latin1 <- "M\xe4chler"

tests/testthat/test-watcher.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
test_that("fails", {
2+
for (i in 1:5) {
3+
test_that(paste0(i), fail())
4+
}
5+
})
16
test_that("compare state works correctly", {
27
loc <- withr::local_tempfile(pattern = "watcher")
38
dir.create(loc)

0 commit comments

Comments
 (0)