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

test: Refactor snapshot testing #1783

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

test: Refactor snapshot testing #1783

wants to merge 3 commits into from

Conversation

rschristian
Copy link
Member

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

@rschristian rschristian requested a review from a team as a code owner February 5, 2023 09:45
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2023

⚠️ No Changeset found

Latest commit: effd025

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rschristian
Copy link
Member Author

Test failure is due to differing paths in comments in SSR bundle. Need to think on that, don't really want to do too much fiddling with bundles to normalize, but we might need to.

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.

1 participant