File tree 3 files changed +12
-1
lines changed
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
# testthat (development version)
2
2
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
+
3
8
# testthat 3.1.9
4
9
5
10
* New ` expect_contains() ` and ` expect_in() ` that works similarly to
Original file line number Diff line number Diff line change 65
65
# ' cat("\n")
66
66
# ' })
67
67
local_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 )
69
69
if (edition_get() > = 3 ) {
70
70
local_reproducible_output(.env = .env )
71
71
}
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