From 4c87feae53e18f9ef8e8748edc392891aff4e525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20B=C3=A5=C3=A5th?= Date: Sat, 11 Nov 2017 15:17:33 +0100 Subject: [PATCH] first stab at print method --- R/reporter-project.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/R/reporter-project.R b/R/reporter-project.R index 6a9c587..f38b15a 100644 --- a/R/reporter-project.R +++ b/R/reporter-project.R @@ -57,6 +57,23 @@ ProjectReporter <- R6::R6Class("ProjectReporter", inherit = testthat::ListReport message = message, success = success, outcome = outcome) + }, + print = function() { + end_report <- self$end_reporter() + summary <- end_report$summary + tests <- do.call(rbind, lapply(end_report$tests, data.frame, stringsAsFactors=FALSE)) + tests <- tests[ ! tests$success, ] + tests <- end_report$tests + cat("Tests:", summary$tests, ", Failures:", summary$failures, ", Errors: ", summary$errors, sep = "") + cat("\n") + for(i in seq_along(tests)) { + test <- tests[[i]] + if(test$success) next + cat(">", test$outcome, "::", test$name) + cat("\n") + cat( test$message, "\n---\n") + } + invisible(self) } ), private = list(