-
Notifications
You must be signed in to change notification settings - Fork 18
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
Inline snapshot overwriting for snapbox #221
Comments
expect-test is also pretty minimal. The biggest problem is getting the path to the file. At the moment, only heuristics work or people have to opt-in to a hacky solution. rust-lang/cargo#3946 would unblock that which is what I've been waiting on. |
I see, thanks for elaborating :) (link to the issue you mentioned: rust-lang/cargo#3946) |
Thanks; its too easy to overlook crossing repo boundaries when linking |
As mentioned in #225, the new API I expect for this would be something like In fact, that API refactor can happen before the requisite cargo features are available. |
Snapbox currently only appears to support
SNAPSHOTS=overwrite
forassert_eq_path
andassert_matches_path
but not for inline snapshot assertions likeassert_eq
orassert_matches
.The popular cargo-insta tool does support the updating of inline snapshots. So I think the current lack of support should certainly be documented.
If supporting inline snapshots is out of the scope of snapbox, I think a reference to Insta in the documentation would be nice.
If it is within scope of snapbox, reliably parsing Rust code would require a dependency on syn, which however could be feature-gated and disabled by default. The inline::FilePatcher implementation of cargo-insta looks quite brief, which would suggest that supporting this feature wouldn't take much additional code here.
The text was updated successfully, but these errors were encountered: