devtools::document() is a wrapper for
roxygen2::roxygenize. If you read the documentation of the latter it says:
Note that roxygen2 is a dynamic documentation system: it works using by inspecting loaded objects in the package. This means that you must be able to load the package in order to document it.
And also there is an argument
load_code which says:
A function used to load all the R code in the package directory. It is called with the path to the package, and it should return an environment containing all the sourced code.
Therefore, it looks like it is reading all
.R files. However, I have a feeling that it skips all .R files that start with
test_ in the name (otherwise I would have seen my packages break as well). I think the problem is your
helper_db.R file where you use
testthat functions in a file not starting with