Is there any way to reproduce the medium that is used devtools::check
?
I have a problem with what my tests work with devtools::test()
, but crashes in devtools::check()
. My problem is how to find the problem. The report check
simply prints the last few lines of the error log, and I cannot find the full report for testing.
checking tests ... ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
...
I know that I am check
using a different environment compared to test
, but I do not know how to debug these problems, since they do not reproduce at all. Especially these tests, where it works several months ago, so they are not sure where to look for the problem.
EDIT
Actually, I tried to find my problem, and found a solution. But in order to publish my solution, I have to add more information.
Thus, my test always failed, since I tested the markdown script if it worked without errors, and then I checked if some of the environment variables were set correctly. This is where the results that I calculate with the script, as well as the standard settings that I set. So I wanted to get a warning if I forgot to change some of my settings after development ...
In any case, since this is a markdown script, I had to extract the code, and I used the comments from this knitr post: run all the pieces in the Rmarkdown document using knitr::purl
to get the code and sys.source
to execute it.
runAllChunks <- function(rmd, envir=globalenv()){
tempR <- tempfile(tmpdir = '.', fileext = ".R")
on.exit(unlink(tempR))
knitr::purl(rmd, output=tempR, quiet=TRUE)
sys.source(tempR, envir=envir)
}
- , ( , ...). , knitr::knit
, , , , .
, , , , .