-
-
Notifications
You must be signed in to change notification settings - Fork 128
feat: Support diffing text "binary" snapshots #708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There's definitely something useful here; I can see some good cases for using the binary snapshot format for text files; for example when we want a raw file without a header. I'm a bit concerned that this could lead to some unexpected behavior though:
|
I think we can draw some inspiration to how
You could also force the diff to compare files as text using the I could add an option in the Tool Config File that could enable diffing binary files as text with a In regards to addressing your concerns in the case we make it opt-in
|
Yes I think that could be viable! That said, I'm a bit concerned that we're adding more options to our interface when there's a quite reasonable alternative — accepting the snapshot and running a If there's a way of building this so it's either:
...then I would support this Also ofc open to others' views! |
I updated the PR to accept a In regards to the better alternative in accepting then Some follow up
Thanks for the feedback and am as always super open on iterating more on this to achieve the desired behavior! |
Thanks @PookieBuns I'm still -0.2 about this — it seems to add settings to get to a config that a) is only marginally useful relative to alternatives, even taking into account CI b) is a setting that's better per-snapshot than per-project, because some binary snapshots are going to be too large or show mangled characters. I'm very open to other thoughts — does anyone else have a view here? I wonder whether there's some snapshot type that's like |
Thanks to #610 we have covered a large step in being able to use insta for schema snapshotting as per #475 . However, currently binary files cannot be diffed when running
cargo test
orcargo insta review
. This makes it difficult to compare and review changes when examining schema changes. This PR allowsinsta
to try to utf-8 decode binary files that are text based to allow this subset of files to be diffed in the workflow