Skip to content

Commit

Permalink
Output Junit timestamps in ISO 8601 and use all three decimal places (#…
Browse files Browse the repository at this point in the history
…924)

* Output timestamps in ISO 8601

* There is an extra rounding step that is not needed

* Add note to NEWS
  • Loading branch information
jimhester authored and hadley committed Aug 26, 2019
1 parent 7549e48 commit 1d04028
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# testthat (development version)


* JunitReporter now reports tests in ISO 8601 in the UTC timezone and also uses
the maximum 3 decimal place precision (#923).

* New `exp_signal()` function. This is a condition signaller that
implements the testthat protocol (signal with `stop()` if the
expectation is broken, with a `continue_test` restart).
Expand Down
4 changes: 2 additions & 2 deletions R/reporter-junit.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ JunitReporter <- R6::R6Class("JunitReporter",
file_name = NULL,

elapsed_time = function() {
time <- round((private$proctime() - self$timer)[["elapsed"]], 2)
time <- (private$proctime() - self$timer)[["elapsed"]]
self$timer <- private$proctime()
time
},
Expand Down Expand Up @@ -153,7 +153,7 @@ JunitReporter <- R6::R6Class("JunitReporter",
proc.time()
},
timestamp = function() {
toString(Sys.time())
strftime(Sys.time(), "%Y-%m-%dT%H:%M:%SZ", tz = "UTC")
},
hostname = function() {
Sys.info()[["nodename"]]
Expand Down

0 comments on commit 1d04028

Please sign in to comment.