Skip to content

Commit

Permalink
Fix for skip outside test (#2039)
Browse files Browse the repository at this point in the history
Fixes #2038
  • Loading branch information
kevinushey authored Dec 12, 2024
1 parent dbe8883 commit 24ff6c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# testthat (development version)

* Fixed an issue where calling `skip()` outside of an active test could
cause an unexpected error (@kevinushey, #2039).

# testthat 3.2.2

## New expectations
Expand Down
4 changes: 3 additions & 1 deletion R/snapshot-reporter.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ SnapshotReporter <- R6::R6Class("SnapshotReporter",
},

start_test = function(context, test) {
self$test <- gsub("\n", "", test)
if (is.character(test)) {
self$test <- gsub("\n", "", test)
}
},

# Called by expectation
Expand Down

0 comments on commit 24ff6c0

Please sign in to comment.