From 66c2d526169dad638b8dcde8fc8e9b3213503f57 Mon Sep 17 00:00:00 2001 From: Rob Baker Date: Tue, 20 Aug 2024 16:29:35 -0600 Subject: [PATCH] add helper function to mask testthat::test_path until bug fix is merged into testhat --- tests/testthat/helper.R | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/testthat/helper.R diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R new file mode 100644 index 0000000..ab4769e --- /dev/null +++ b/tests/testthat/helper.R @@ -0,0 +1,10 @@ +test_path <- function(...) { + # testthat::test_path() returns incorrect value + # when in the context of devtools::test_coverage_active_file() + path <- file.path(...) + if (file.exists(path)) { + path + } else { + file.path("tests/testthat/", path) + } +}