Adjust force-update on inline snapshots to only view within the string#581
Conversation
7d8220b to
a1880f0
Compare
|
OK, I think this is in a pretty good state now — again, more changes than ideal — but I think moving the library to be simpler, fewer corners (+ with #563 we'll separate out any legacy snapshot normalizations, will be good) |
|
@mitsuhiko this one is top of my list for you to review when you get the chance to review things; think it's a much better experience for users; somewhat to your point when merging the PR that enabled forcing inline snapshot updates |
|
@mitsuhiko I think the benefits of this are large enough, and I would like to minimize conflicts with #489, that it's worth me merging without waiting longer for a review. The main drawback is potentially one of performance — the current code does many more allocations, albeit in non-perf-sensitive code. I recognize you gave me merge permissions with the understanding I would be careful, so:
|
Stacks on #581, merge that first Now that we've consolidated the checks for whether to write snapshots into `matches_fully`, I think we can remove the check on whether the file contents match.
This solves the issue in #573 for the moment:
--force-update-snapshotsin 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--force-update-snapshotswithout--accept#573 (comment)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