Skip to content

Commit acfae29

Browse files
authored
Show variant when snapshot changes (#1541)
Fixes #1540
1 parent 9355d8f commit acfae29

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
when you've temporarily set the locale to non-UTF-8 (#1285).
88

99
* When a snapshot changes the hint also mentions that you can use
10-
`snapshot_review()` (#1500, @DanChaltiel).
10+
`snapshot_review()` (#1500, @DanChaltiel) and the message tells you what
11+
variant is active (#1540).
1112

1213
* `snapshot_accept()` now works better with variants (#1508).
1314

R/snapshot.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,19 @@ expect_snapshot_helper <- function(lab, val,
368368
variant = variant
369369
)
370370

371+
if (!identical(variant, "_default")) {
372+
variant_lab <- paste0(" (variant '", variant, "')")
373+
} else {
374+
variant_lab <- ""
375+
}
371376
hint <- snapshot_accept_hint(variant, snapshotter$file)
372377

373378
expect(
374379
length(comp) == 0,
375380
sprintf(
376-
"Snapshot of %s has changed:\n%s\n\n%s",
381+
"Snapshot of %s has changed%s:\n%s\n\n%s",
377382
lab,
383+
variant_lab,
378384
paste0(comp, collapse = "\n\n"),
379385
hint
380386
),

0 commit comments

Comments
 (0)