Skip to content

Commit 75c70e0

Browse files
authored
Rely on load_all() to load helpers (#1983)
Otherwise effectively unload them for the developer. Fixes #1982
1 parent 35b81f1 commit 75c70e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

R/test-files.R

+10-1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ test_files_serial <- function(test_dir,
197197
load_package = c("none", "installed", "source"),
198198
error_call = caller_env()) {
199199

200+
# Because load_all() called by test_files_setup_env() will have already
201+
# loaded them. We don't want to rely on testthat's loading since that
202+
# only affects the test environment and we want to keep the helpers
203+
# loaded in the user's session.
204+
load_package <- arg_match(load_package)
205+
if (load_package == "source") {
206+
load_helpers <- FALSE
207+
}
208+
200209
env <- test_files_setup_env(test_package, test_dir, load_package, env)
201210
# record testing env for mocks
202211
local_testing_env(env)
@@ -244,7 +253,7 @@ test_files_setup_env <- function(test_package,
244253
}
245254

246255
find_load_all_args <- function(path) {
247-
default <- list(export_all = TRUE, helpers = FALSE)
256+
default <- list(export_all = TRUE, helpers = TRUE)
248257

249258
desc <- find_description(path)
250259
if (is.null(desc)) {

0 commit comments

Comments
 (0)