Skip to content

Commit

Permalink
And old named snapshot metadata formats
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Jun 17, 2024
1 parent 1266b19 commit 6d9c702
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to insta and cargo-insta are documented here.

## 1.40.0

- Print a warning for old inline snapshot formats.
- Print a warning when encountering old snapshot formats. #503

## 1.39.0

Expand Down
1 change: 1 addition & 0 deletions insta/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub struct ToolConfig {
require_full_match: bool,
output: OutputBehavior,
snapshot_update: SnapshotUpdate,
// minimum_insta_version: Option<Version>,
#[cfg(feature = "glob")]
glob_fail_fast: bool,
#[cfg(feature = "_cargo_insta_internal")]
Expand Down
3 changes: 2 additions & 1 deletion insta/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ impl Snapshot {
}
}
}
eprintln!("A snapshot uses an old snapshot format; please update it to the new format with `cargo insta --force-update-snapshots.\n\nSnapshot is at: {}", p.to_string_lossy());
rv
};

Expand Down Expand Up @@ -670,7 +671,7 @@ fn get_inline_snapshot_value(frozen_value: &str) -> String {
// (the only call site)

if frozen_value.trim_start().starts_with('⋮') {
eprintln!("Value uses an old snapshot format; please update it to the new format with `cargo insta --force-update-snapshots.\n\nValue: {}", frozen_value);
eprintln!("A snapshot uses an old snapshot format; please update it to the new format with `cargo insta --force-update-snapshots.\n\nValue: {}", frozen_value);

// legacy format - retain so old snapshots still work
let mut buf = String::new();
Expand Down

0 comments on commit 6d9c702

Please sign in to comment.