Skip to content
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

Use INSTA_UPDATE=force for forcing snapshot updates #482

Merged
merged 34 commits into from
Sep 15, 2024

Conversation

max-sixty
Copy link
Collaborator

@max-sixty max-sixty commented May 2, 2024

In an effort to simplify the configs, this merges the INSTA_UPDATE and INSTA_FORCE_UPDATE configs. Conceptually, INSTA_FORCE_UPDATE overwrites INSTA_UPDATE; they naturally fit into the same config setting.

I realized after starting this that we want to be careful about supporting new & old versions of cargo-insta. So this takes a conservative approach, only changing insta at first, but with the future updates to cargo-insta commented in the code. I realize that adds a bit of complication; though on balance I think simplifying the configs would be helpful and this makes a step towards that. Adjusted to use the underlying version of insta; I think a good approach!

It stacks on #479, which should merge first. Merged

I'd be open to writing some tests for this if that'd be helpful. Written

This attempts to clarify when snapshots are written to draft `.snap.new` files as opposed to overwriting `.snap` files
In an effort to simplify the configs, this merges the `INSTA_UPDATE` and `INSTA_FORCE_UPDATE`. I don't think it's possible to require these both; they naturally fit into the same config setting.

I realized after starting this that we want to be careful about supporting new & old versions of `cargo-insta`. So this takes a conservative approach, only changing `insta` at first, but with the future updates to `cargo-insta` commented in the code. I realize that adds a bit of complication; though on balance I think simplifying the configs would be helpful.

It stacks on mitsuhiko#479, which should merge first.

I'd be open to writing some tests for this if that'd be helpful.
@mitsuhiko
Copy link
Owner

I think this makes sense in general. I do want to run this first though so I will hold on merging until the next release.

@max-sixty
Copy link
Collaborator Author

max-sixty commented Aug 4, 2024

The latest commit:

  • Targets the insta version when deciding which env var to use. This lets us support older versions while also using the new env var immediately for newer versions
  • Adds some integration tests for both pre & post 1.40.0
  • For those to work, I needed to bump the current version in the repo to 1.40.0. (FYI for similar reasons, we bump the version in PRQL immediately after releasing, rather than immediately before.)
  • Bumps MSRV to 1.65 for cargo-insta...

max-sixty added a commit to max-sixty/insta that referenced this pull request Aug 4, 2024
We don't use this yet, but could be helpful in areas such as mitsuhiko#482
max-sixty added a commit that referenced this pull request Aug 9, 2024
We don't use this yet, but could be helpful in areas such as #482
@mitsuhiko
Copy link
Owner

I would merge this but could you resolve the conflicts?

@max-sixty
Copy link
Collaborator Author

max-sixty commented Aug 31, 2024

OK, done. The prior commit actually caught a semantic conflict when running --force-update-snapshots on inline snapshots, so made a small change to make that work.

This PR ends up being a lot of additional code for a "simplification" PR. But in retrospect I think in the long-long term it does get simpler, and there's some nice machinery here for making insta & cargo-insta work together nicely (+ our ability to test that).

max-sixty added a commit that referenced this pull request Sep 1, 2024
@max-sixty
Copy link
Collaborator Author

Missed the release so changed the 1.39->1.40, 1.40->1.41

@max-sixty
Copy link
Collaborator Author

Will merge in the next week without more feedback, given the note above, to keep things moving.

Lmk if that's too aggressive, both for this PR and the principle

@max-sixty max-sixty merged commit 59568b7 into mitsuhiko:master Sep 15, 2024
15 checks passed
@max-sixty max-sixty deleted the snapshot-force branch September 15, 2024 22:41
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.

2 participants