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.
What kind of change does this PR introduce?
Testing refactor
Did you add tests for your changes?
Yes
Summary
The existing snapshot tests were quite time consuming to update, as they weren't making use of Jest's snapshots. Every time a file hash changed or output deviated beyond the +/- 5% bound, the contributor would need to manually update. When a few hashes or output sizes changed, this was a slow and annoying process.
This PR switches over to using actual snapshots, though there is a downside: Jest has no "Snapshot sorta matches" functionality, so if there's any deviation at all in a file size, we need to update. I don't see this as too much of an issue though, as it's so quick to update (simply append
-u
to the test command, and Jest itself informs you of this). Also, it's a nice canary for changes that shouldn't have changed output sizes at all -- in the past, anything within +/- 5% would be hidden.This will greatly reduce the time I spend updating tests after I've determined a change should be made to the stored images.
Does this PR introduce a breaking change?
N/A