From 81d2f6eb618cc0ac4bb8700e0e5c7318699d68e6 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Wed, 9 Nov 2022 22:34:59 -0800 Subject: [PATCH] report elapsed time even if tests fail --- R/test.data.table.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/test.data.table.R b/R/test.data.table.R index fd7750ef08..0f6525e652 100644 --- a/R/test.data.table.R +++ b/R/test.data.table.R @@ -165,7 +165,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F if (inherits(err,"try-error")) { # nocov start if (silent) return(FALSE) - stopf("Failed after test %s before the next test() call in %s", env$prevtest, fn) + stopf("Failed in %s after test %s before the next test() call in %s", timetaken(env$started.at), env$prevtest, fn) # the try() above with silent=FALSE will have already printed the error itself # nocov end } @@ -175,8 +175,8 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F if (nfail > 0L) { # nocov start stopf( - "%d error(s) out of %d. Search %s for test number(s) %s", - nfail, ntest, names(fn), toString(env$whichfail) + "%d error(s) out of %d. Search %s for test number(s) %s. Elapsed time: %s.", + nfail, ntest, names(fn), toString(env$whichfail), timetaken(env$started.at) ) # important to stopf() here, so that 'R CMD check' fails # nocov end