From 5518cff52eaf63a2e6d73115f27a7fb657bd9937 Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Thu, 4 Dec 2025 06:30:38 -0600 Subject: [PATCH 1/2] Fix test_coverage_active_file() for testthat 3.3 Name `snap_dir` arg for `testthat::local_snapshotter()` in `test_coverage_active_file()` Fixes #2630 --- R/test.R | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/R/test.R b/R/test.R index 0bbe0fcc9..7a38fd8c8 100644 --- a/R/test.R +++ b/R/test.R @@ -119,9 +119,9 @@ test_coverage_file <- function(file = find_active_file(), ...) { #' @rdname test #' @export test_coverage_active_file <- function(file = find_active_file(), - filter = TRUE, - show_report = interactive(), - export_all = TRUE, + filter = TRUE, + show_report = interactive(), + export_all = TRUE, ...) { rlang::check_installed(c("covr", "DT")) check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn)) @@ -138,11 +138,13 @@ test_coverage_active_file <- function(file = find_active_file(), # To correctly simulate test_file() we need to set up both a temporary # snapshotter (with correct directory specification) for snapshot comparisons # and a stop reporter to inform the user about test failures - snap_reporter <- testthat::local_snapshotter(file.path(test_dir, "_snaps")) + snap_reporter <- testthat::local_snapshotter( + snap_dir = file.path(test_dir, "_snaps") + ) snap_reporter$start_file(basename(test_file)) reporter <- testthat::MultiReporter$new(reporters = list( - testthat::StopReporter$new(praise = FALSE), - snap_reporter + testthat::StopReporter$new(praise = FALSE), + snap_reporter )) withr::local_envvar(r_env_vars()) From 9d94333a60463b9c226669d3ff93cca1547758ab Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Thu, 8 Jan 2026 11:41:38 -0600 Subject: [PATCH 2/2] Undo whitespace changes --- R/test.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/test.R b/R/test.R index 7a38fd8c8..725f4e320 100644 --- a/R/test.R +++ b/R/test.R @@ -119,9 +119,9 @@ test_coverage_file <- function(file = find_active_file(), ...) { #' @rdname test #' @export test_coverage_active_file <- function(file = find_active_file(), - filter = TRUE, - show_report = interactive(), - export_all = TRUE, + filter = TRUE, + show_report = interactive(), + export_all = TRUE, ...) { rlang::check_installed(c("covr", "DT")) check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn)) @@ -143,8 +143,8 @@ test_coverage_active_file <- function(file = find_active_file(), ) snap_reporter$start_file(basename(test_file)) reporter <- testthat::MultiReporter$new(reporters = list( - testthat::StopReporter$new(praise = FALSE), - snap_reporter + testthat::StopReporter$new(praise = FALSE), + snap_reporter )) withr::local_envvar(r_env_vars())