From 16906d110cc2eefbe35d54ec9423b5541ca214d1 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Mon, 9 Mar 2026 15:47:17 -0500 Subject: [PATCH] Fix bug with `test_coverage_active_file()` --- R/test.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/test.R b/R/test.R index 92ed59ad7..d95dc760a 100644 --- a/R/test.R +++ b/R/test.R @@ -128,6 +128,11 @@ test_coverage_active_file <- function( pkg <- as.package(test_dir) env <- load_all(pkg$path, quiet = TRUE, export_all = export_all)$env + + # Must capture before local_test_directory() sets TESTTHAT envvar, + # which causes rlang::is_interactive() to return FALSE + report <- report_default(report) + # this always ends up using the package DESCRIPTION, which will refer # to the source package because of the load_all() above testthat::local_test_directory(test_dir, pkg$package)