Skip to content

Commit

Permalink
Update testthat.R
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdguy committed Jul 7, 2022
1 parent 0564ddd commit 14148f8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
pkg_name <- "hermes"
if (requireNamespace("testthat", quietly = TRUE)) {
library(testthat)
reporter <- MultiReporter$new(list(
CheckReporter$new(),
JunitReporter$new(file = "junit-result.xml")
))
test_results <- test_check(pkg_name, reporter = reporter)
saveRDS(test_results, "unit_testing_results.rds")
is_on_ci <- isTRUE(as.logical(Sys.getenv("CI")))
if (is_on_ci) {
reporter <- MultiReporter$new(list(
CheckReporter$new(),
JunitReporter$new(file = "junit-result.xml")
))
test_results <- test_check(pkg_name, reporter = reporter)
saveRDS(test_results, "unit_testing_results.rds")
} else {
reporter <- ParallelProgressReporter$new()
test_check(pkg_name, reporter = reporter)
}
}

0 comments on commit 14148f8

Please sign in to comment.