draft: Prevent lots of empty inline snapshots with --force-update-snapshots without --accept#573
Closed
max-sixty wants to merge 1 commit intomitsuhiko:masterfrom
Closed
draft: Prevent lots of empty inline snapshots with --force-update-snapshots without --accept#573max-sixty wants to merge 1 commit intomitsuhiko:masterfrom
--force-update-snapshots without --accept#573max-sixty wants to merge 1 commit intomitsuhiko:masterfrom
Conversation
…apshots` without `--accept` I realize what you mean in the prior comment. Currently running with `--accept` is kinda painful. I'm not sure how common that is, but would be nice to fix. Had a go for 30 mins, need to run, but pushing an initial effort and a pointer to the thing that needs fixing
Collaborator
Author
|
OK, I think I understand the underlying problem here. In a test like:
A couple of ideas, none are great:
My current thinking is to revert #569, and then default to |
Collaborator
Author
|
I think this is broadly fixed in #581 |
max-sixty
added a commit
that referenced
this pull request
Sep 19, 2024
#581) This solves the issue in #573 for the moment: - When `--force-update-snapshots` in passed, we only update inline snapshots when there's some difference _within_ the string, such as an additional linebreak at the start or the end - We no longer update the surrounding hashes. In the existing code, this happened because we were writing too many inline snapshots, not because we were actually checking the number of hashes - Checking the number of hashes isn't easy to do — reason outlined at #573 (comment) - The main change in the code is that we store the unnormalized snapshot and then normalize when we need to. The existing code stored the normalized version, which meant we couldn't evaluate whether the unnormalized versions were different It's a decent number of changes, but will integrate nicely with #563. ~(FYI we currently don't look at the indentation, but we could adjust this)~ Now indentation works too
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I realize what you mean in the prior comment. Currently running with
--acceptis kinda painful. I'm not sure how common that is, but would be nice to fix.Had a go for 30 mins, need to run, but pushing an initial effort and a pointer to the thing that needs fixing