I would like to run my package unit tests during R CMD check
, but skip tests that require an internet connection. By convention, all unit tests that require internet have the word network
in their filename.
Hence my run-all.R
contains:
library(testthat)
test_package("mypackage", filter="^((?!network).)*$")
However this gives an invalid regular expression
error. How do I specify the filter
argument such that it runs each unit test except the ones with the word network
in them?
Use the
invert
argument:The
invert
argument eventually gets forwarded togrepl
via the...
argument viatest_check
->run_tests
->test_dir
-> etc. From?test_dir
: