Skip to content

Commit eea12e6

Browse files
Correct {cli} markup for informative failure (#2296)
1 parent 224e41a commit eea12e6

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# testthat 3.3.1
22

3+
* `expect_snapshot_file()` correctly reports file name if duplicated (@MichaelChirico, #2296).
34
* Fixed support for `shinytest2::AppDriver$expect_values()` screenshot snapshot failing on CI (#2293, #2288).
45

56
* testthat now emits OpenTelemetry traces for tests when tracing is enabled. Requires the otel and otelsdk packages (#2282).

R/snapshot-reporter.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ SnapshotReporter <- R6::R6Class(
135135
save_path <- paste0(c(self$file, variant, name), collapse = "/")
136136
if (save_path %in% self$snap_file_saved) {
137137
cli::cli_abort(
138-
"Snapshot file names must be unique. {.arg name} has already been used.",
138+
"Snapshot file names must be unique. {.val {name}} has already been used.",
139139
call = trace_env
140140
)
141141
}

tests/testthat/_snaps/snapshot-file.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
expect_snapshot_file(write_tmp_lines(r_version()), "version.txt", variant = r_version())
55
Condition
66
Error in `expect_snapshot_file()`:
7-
! Snapshot file names must be unique. `name` has already been used.
7+
! Snapshot file names must be unique. "version.txt" has already been used.
88

99
# warns on first creation
1010

0 commit comments

Comments
 (0)