File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11# testthat (development version)
22
3+ * ` testthat ` now sets the ` _R_CHECK_BROWSER_NONINTERACTIVE_ ` environment variable
4+ when running tests. This should ensure that left-over ` browser() ` statements
5+ will trigger an error if encountered while running tests. This functionality
6+ is only enabled with R (>= 4.3.0). (#1825 )
7+
38# testthat 3.1.9
49
510* New ` expect_contains() ` and ` expect_in() ` that works similarly to
Original file line number Diff line number Diff line change 6565# ' cat("\n")
6666# ' })
6767local_test_context <- function (.env = parent.frame()) {
68- withr :: local_envvar(TESTTHAT = " true" , .local_envir = .env )
68+ withr :: local_envvar(" _R_CHECK_BROWSER_NONINTERACTIVE_ " = " true " , TESTTHAT = " true" , .local_envir = .env )
6969 if (edition_get() > = 3 ) {
7070 local_reproducible_output(.env = .env )
7171 }
Original file line number Diff line number Diff line change 1+
2+ test_that(" browser() usages are errors in tests" , {
3+ skip_if(getRversion() < " 4.3.0" )
4+ if (! interactive())
5+ expect_error(browser())
6+ })
You can’t perform that action at this time.
0 commit comments