Watches R files in the app
directory and tests/testthat
directory for changes.
When code files in app
change, all tests are rerun. When test files change,
only the changed test file is rerun.
Arguments
- reporter
{testthat}
reporter to use. If NULL, will usetestthat::default_reporter()
for tests when running all tests andtestthat::default_compact_reporter()
for single file tests. See{testthat}
reporters for more details.- filter
filter passed to
testthat::test_dir()
. If not NULL, only tests with file names matching this regular expression will be executed. Matching is performed on the file name after it's stripped of "test-" and ".R". Does not affect the case when a test file is changed. In this case, this test file is rerun.- hash
Logical. Whether to use file hashing to detect changes. Default is TRUE. If FALSE, file modification times are used instead.
Examples
if (interactive()) {
# Watch files and automatically run tests when changes are detected
auto_test_r()
}