diff --git a/NEWS.md b/NEWS.md index 5bb8c28db..e833c445b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # testthat (development version) +* `expect_snapshot()` now strips line breaks in test descriptions (@LDSamson, #1900). * `expect_snapshot()` now errors when called from a `test_that()` that has an empty description (@kevinushey, #1980). * `skip_if_not_installed()` produces a clearer message (@MichaelChirico, #1959). * `with_mock()` and `local_mock()` have been unconditionally deprecated as they will no longer work in future versions of R (#1999). diff --git a/R/snapshot-reporter.R b/R/snapshot-reporter.R index ebedcde65..7f7989d6c 100644 --- a/R/snapshot-reporter.R +++ b/R/snapshot-reporter.R @@ -35,7 +35,7 @@ SnapshotReporter <- R6::R6Class("SnapshotReporter", }, start_test = function(context, test) { - self$test <- test + self$test <- gsub("\n", "", test) }, # Called by expectation