From 69d4559c0d806eb267828c8b08be00fc9cbd01e5 Mon Sep 17 00:00:00 2001 From: JesseAlderliesten <59017087+JesseAlderliesten@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:31:13 +0200 Subject: [PATCH] Informative error for for `tinytest::test_all()` with non-existent or empty `inst/testdir`. --- pkg/R/tinytest.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/R/tinytest.R b/pkg/R/tinytest.R index 266bfd9..585ff72 100644 --- a/pkg/R/tinytest.R +++ b/pkg/R/tinytest.R @@ -860,10 +860,17 @@ run_test_dir <- function(dir="inst/tinytest", pattern="^test.*\\.[rR]$" t0 <- Sys.time() + if (!dir.exists(dir) || file.exists(dir)){ + tinytest:::stopf("dir '%s' does not exist or is a file", dir) + } + testfiles <- dir(dir, pattern=pattern, full.names=TRUE) testfiles <- locale_sort(testfiles, lc_collate=lc_collate) + if (length(testfiles) == 0L) { + tinytest:::stopf("dir '%s' does not contain test files", dir) + } if ( !inherits(cluster, "cluster") ){ # set pwd here, to save time in run_test_file.