diff --git a/NEWS.md b/NEWS.md index e2b1cc0a7..20fc8d942 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # testthat (development version) +* Fixed an issue where calling `skip()` outside of a test could cause + an unexpected error (@kevinushey, #2038). + # testthat 3.2.2 ## New expectations diff --git a/R/snapshot-reporter.R b/R/snapshot-reporter.R index 7f7989d6c..5904fd043 100644 --- a/R/snapshot-reporter.R +++ b/R/snapshot-reporter.R @@ -116,7 +116,7 @@ SnapshotReporter <- R6::R6Class("SnapshotReporter", }, add_result = function(context, test, result) { - if (is.null(self$test)) { + if (!length(self$test)) { return() }