Skip to content

Add PublicApi::assert_eq_or_update(&self, snapshot_path: impl AsRef<Path>)#818

Merged
Enselic merged 2 commits intomainfrom
txt-snapshots
Aug 11, 2025
Merged

Add PublicApi::assert_eq_or_update(&self, snapshot_path: impl AsRef<Path>)#818
Enselic merged 2 commits intomainfrom
txt-snapshots

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Aug 7, 2025

We currently recommend using insta for snapshot testing, but unfortunately that results in very hard to read diffs because of mitsuhiko/insta#425. The .gitattributes workaround does not work. The below diff uses the workaround:

image

To avoid this problem, let's go back to using .txt files for snapshots. To help out I created a tiny new crate called snapshot-testing. It uses the same very nice diffing engine of insta but without the problematic .snap extension.

Also note that we put the diffing engine behind a cargo feature so that users with their own snapshot testing library can avoid unnecessary dependencies.

To make review easier, this PR has two commits. One with the code changes and one with just the snapshots updated.

@Enselic Enselic force-pushed the txt-snapshots branch 2 times, most recently from 1dcd72e to 5adf72d Compare August 8, 2025 20:07
@Enselic Enselic marked this pull request as ready for review August 8, 2025 20:08
@Enselic Enselic force-pushed the txt-snapshots branch 2 times, most recently from 078231a to 9345246 Compare August 11, 2025 06:24
…Path>)`

We currently recommend using `insta` for snapshot testing, but
unfortunately that results in very hard to read diffs.

To avoid this problem, let's go back to using `.txt` files for
snapshots. To help out I created a tiny new crate called
`snapshot-testing`. It uses the same very nice diffing engine of `insta`
but without the problematic `.snap` extension. (The `.gitattributes`
workaround does not work.)
@Enselic Enselic enabled auto-merge August 11, 2025 06:26
@Enselic Enselic added this pull request to the merge queue Aug 11, 2025
Merged via the queue into main with commit ccc74ea Aug 11, 2025
8 checks passed
@Enselic Enselic deleted the txt-snapshots branch August 11, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant