4646# ' @export
4747test_subdir <- function (subdir , base_path = ' .' , ... ){
4848
49- find_test_dir_mock <- function (path )
50- {
49+ find_test_dir_mock <- function (path ){
5150 testthat <- file.path(path , " tests" , " testthat" , subdir )
5251 if (dir.exists(testthat ))
5352 return (testthat )
@@ -105,7 +104,9 @@ test_manual <- function(base_path = '.', ...){
105104
106105
107106
108- # ' `test_all()` Runs the tests in \file{tests/testthat} and its (first-level) subdirectories
107+
108+ # ' `test_all()` Runs the tests in \file{tests/testthat} and all its
109+ # ' subdirectories (except \file{testdata} and \file{testdata-raw}).
109110# ' @rdname test_subdir
110111# ' @export
111112test_all <- function (
@@ -126,10 +127,31 @@ test_all <- function(
126127
127128 testthat :: with_mock(
128129 devtools :: test(reporter = reporter ),
129- `testthat::find_test_scripts` = function (path , filter = NULL , invert = FALSE , ... ) {
130- files <- dir(path , " ^test.*\\ .[rR]$" , full.names = TRUE , recursive = TRUE )
131- files <- grep(" tests/testthat/testdata" , files , value = TRUE , invert = TRUE )
132- testthat ::: filter_test_scripts(files , filter , invert , ... )
133- }
130+ `testthat::find_test_scripts` = find_test_scripts_mock
134131 )
135132}
133+
134+
135+
136+
137+ find_test_scripts_mock <- function (
138+ path ,
139+ filter = NULL ,
140+ invert = FALSE ,
141+ ...
142+ ){
143+ files <- dir(
144+ path , " ^test.*\\ .[rR]$" ,
145+ full.names = TRUE ,
146+ recursive = TRUE
147+ )
148+
149+ files <- grep(
150+ " tests/testthat/test(data/)|(data-raw/)" ,
151+ files ,
152+ value = TRUE ,
153+ invert = TRUE
154+ )
155+
156+ testthat ::: filter_test_scripts(files , filter , invert , ... )
157+ }
0 commit comments