diff --git a/R/pkg/tests/run-all.R b/R/pkg/tests/run-all.R index a46924a5d20e..3043df0f1207 100644 --- a/R/pkg/tests/run-all.R +++ b/R/pkg/tests/run-all.R @@ -61,15 +61,18 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { set.seed(42) # TODO (SPARK-30663) To be removed once testthat 1.x is removed from all builds - if (grepl("^1\\..*", packageVersion("testthat"))) { + if (packageVersion("testthat")$major <= 1) { # testthat 1.x test_runner <- testthat:::run_tests reporter <- "summary" - } else { # testthat >= 2.0.0 test_runner <- testthat:::test_package_dir - reporter <- testthat::default_reporter() + dir.create("target/test-reports", showWarnings = FALSE) + reporter <- MultiReporter$new(list( + SummaryReporter$new(), + JunitReporter$new(file = "target/test-reports/test-results.xml") + )) } test_runner("SparkR", diff --git a/appveyor.yml b/appveyor.yml index 1fd91daae901..c40b23c8341e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,8 +41,8 @@ cache: install: # Install maven and dependencies - ps: .\dev\appveyor-install-dependencies.ps1 - # Required package for R unit tests - - cmd: Rscript -e "install.packages(c('knitr', 'rmarkdown', 'testthat', 'e1071', 'survival', 'arrow'), repos='https://cloud.r-project.org/')" + # Required package for R unit tests. xml2 is required to use jUnit reporter in testthat. + - cmd: Rscript -e "install.packages(c('knitr', 'rmarkdown', 'testthat', 'e1071', 'survival', 'arrow', 'xml2'), repos='https://cloud.r-project.org/')" - cmd: Rscript -e "pkg_list <- as.data.frame(installed.packages()[,c(1, 3:4)]); pkg_list[is.na(pkg_list$Priority), 1:2, drop = FALSE]" build_script: