Conditionally stop testing a tinytest test file if running under covr. This is determined by checking if the environment variable “R_COVR” set and is a non-FALSE value

skip_on_covr()

exit_on_covr()

Value

If called within a tinytest test running under covr, triggers an exit condition; otherwise, either a string saying “On covr” or NULL invisibly

“Skip” vs “Exit”

tinyexpect provides both “skip_” and “exit_” versions of “stop testing” functions due to the different philosophies of tinytest and testthat; in testthat, tests are encapsulated by test_that() to create smaller testing units within a single test file. As such, if a series of tests need to be passed over for some reason, it makes sense to “skip” a test_that() block and move on to the next block

tinytest, however, treats each test file as a testing unit. Each file in inst/tinytest is equivalent to a testthat test_that() block; as such, if a series of tests need to be passed over for some reason, it makes sense to “exit” a test file and move on to the next file in inst/tinytest

In order to provide compatibility with users transitioning from testthat to tinytest, and to provide continuity with the tinytest philosophy, tinyexpect provides both skip_- and exit_- prefixed “stop testing” functions that work identically to one another

Examples

withr::with_envvar(c(R_COVR = "true"), skip_on_covr())
#> [1] "On covr"