Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/rel-1738012636'
Browse files Browse the repository at this point in the history
  • Loading branch information
crunchbot committed Jan 27, 2025
2 parents 751e771 + 8376341 commit 96eb735
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ install-ci: deps
test-ci: compress-fixtures |
R --slave -e 'library(covr); install_dir <- tempfile(); test_run <- try(to_cobertura(package_coverage(quiet=FALSE, install_path=install_dir, clean=FALSE))); for (file in list.files(install_dir, pattern = "\\.Rout(\\.fail)?$$", recursive=TRUE, full.names=TRUE)) { cat(readLines(file), sep = "\n"); cat("\n") }; if (inherits(test_run, "try-error")) stop("Test failed!\n", attr(test_run, "condition")[["message"]], "\n", format(attr(test_run, "condition")[["call"]]))'

test-ci-partial: compress-fixtures |
cd tests/ && R --slave -e 'library(devtools); source("../inst/junit_fix.R"); library(testthat); test(filter="${file_regex}", reporter = MultiReporter$$new(list(SummaryReporter$$new(), JunitReporterFix$$new(file = file.path(Sys.getenv("WORKSPACE"), "rcrunch.xml")))));'

clean:
R --slave -e 'library(crunch); set_crunch_opts(crunch.api=envOrOption("test.api"), crunch.api.key=envOrOption("crunch.test.api.key")); lapply(urls(datasets()), crDELETE)'

Expand Down
24 changes: 24 additions & 0 deletions inst/junit_fix.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
tt_read_lines <- function(path, n = -1L, encoding = "UTF-8") {
base::readLines(path, n = n, encoding = encoding, warn = FALSE)
}

tt_write_lines <- function(text, path) {
base::writeLines(enc2utf8(text), path, useBytes = TRUE)
}

# trick to get around :: from depends CRAN check
R6Class <- get("R6Class", asNamespace("R6"))

JunitReporterFix <- R6Class(
"JunitReporterFix",
inherit = JunitReporter,
public = list(
end_reporter = function() {
super$end_reporter()
tt_write_lines(
crayon::strip_style(tt_read_lines(self$out)),
self$out
)
}
)
)

0 comments on commit 96eb735

Please sign in to comment.