From d55f86a7f343b00a3b7dce13d4eff973837b7a4c Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 26 May 2024 19:31:33 +0200 Subject: [PATCH] Fix test warnings workflow (#941) --- .github/workflows/check-test-warnings.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-test-warnings.yaml b/.github/workflows/check-test-warnings.yaml index 8dc3c858e..707d1081b 100644 --- a/.github/workflows/check-test-warnings.yaml +++ b/.github/workflows/check-test-warnings.yaml @@ -27,11 +27,16 @@ jobs: upgrade: 'TRUE' extra-packages: | local::. - any::devtools needs: check - name: Run Tests run: | - options(crayon.enabled = TRUE, warn = 2L) - devtools::test() + options(crayon.enabled = TRUE) + pkgload::load_all() + test_script_paths <- testthat::find_test_scripts("tests/testthat") + test_with_warning_as_error <- function(path) { + withr::local_options(list(warn = 2L)) + testthat::test_file(path, stop_on_failure = TRUE, stop_on_warning = TRUE) + } + purrr::walk(test_script_paths, test_with_warning_as_error) shell: Rscript {0}