R's testthat
package has a number of functions for running tests: https://testthat.r-lib.org/reference/index.html#run-tests. However, the most coarse level you can filter tests seems to be at a file level, since there is a test_file()
function that doesn't have any filtering arguments, and test_dir()
has a filter argument but it is only used to filter by filename.
However I frequently want to only run a single test, because it's new, or because I know it's relevant to a change I just made.
Is there a way, in the R console or in RStudio to run a single testthat
test? If not, is there some other recommended solution to this problem such as putting each test in it's own file (this seems pretty painful though)?