Skip to content

Commit 3ca8b0e

Browse files
max-sixtyclaude
andauthored
Remove confusing 'previously unseen snapshot' message (#812)
## Problem When running `cargo insta test --force-update-snapshots --accept`, existing snapshots showed: ``` created previously unseen snapshot /path/to/snapshot.snap ``` This was confusing since the snapshots weren't new - they were being updated. ## Solution Remove the conditional message logic and always print "updated snapshot" for in-place updates. ## Changes - Simplified message in `runtime.rs:558-562` to always show "updated snapshot" - Kept the TODO comment documenting that the `unseen` logic is inverted (for context) - Updated inline snapshot formatting from test runs ## Notes The `unseen` variable still has inverted logic (`true` when file exists, not when it doesn't), which affects the deprecated `INSTA_UPDATE=unseen` mode. Since that mode is deprecated, we're not fixing the logic - just removing its use in the message. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent dcc2e04 commit 3ca8b0e

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

insta/src/runtime.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,7 @@ impl<'a> SnapshotAssertionContext<'a> {
557557
if should_print {
558558
elog!(
559559
"{} {}",
560-
if unseen {
561-
style("created previously unseen snapshot").green()
562-
} else {
563-
style("updated snapshot").green()
564-
},
560+
style("updated snapshot").green(),
565561
style(snapshot_file.display()).cyan().underlined(),
566562
);
567563
}

insta/src/snapshot.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,11 +1430,10 @@ fn test_empty_lines() {
14301430
multiline content starting on second line
14311431
14321432
final line
1433-
"#, @r###"
1434-
1435-
multiline content starting on second line
1433+
"#, @r"
14361434
1437-
final line
1435+
multiline content starting on second line
14381436
1439-
"###);
1437+
final line
1438+
");
14401439
}

insta/tests/test_inline.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ fn test_inline_test_in_loop() {
299299
#[test]
300300
fn test_inline_snapshot_whitespace() {
301301
assert_snapshot!("\n\nfoo\n\n bar\n\n", @r"
302+
303+
302304
foo
303305
304306
bar

0 commit comments

Comments
 (0)