Skip to content

Commit 24ff6c0

Browse files
authored
Fix for skip outside test (#2039)
Fixes #2038
1 parent dbe8883 commit 24ff6c0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# testthat (development version)
22

3+
* Fixed an issue where calling `skip()` outside of an active test could
4+
cause an unexpected error (@kevinushey, #2039).
5+
36
# testthat 3.2.2
47

58
## New expectations

R/snapshot-reporter.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ SnapshotReporter <- R6::R6Class("SnapshotReporter",
3535
},
3636

3737
start_test = function(context, test) {
38-
self$test <- gsub("\n", "", test)
38+
if (is.character(test)) {
39+
self$test <- gsub("\n", "", test)
40+
}
3941
},
4042

4143
# Called by expectation

0 commit comments

Comments
 (0)