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

Testing: Add first test using snapshots testing #3590

merged 1 commit into from Nov 23, 2017


None yet
1 participant

gziolo commented Nov 21, 2017


This PR refactors one of the existing component tests to use snapshot testing to simplify the code. It also exposes the internal structure of the component in the snapshot file making it easier to reason when building additional tests.

This PR also introduces performance optimization borrowed from Calypso project. My previous explorations have proved that by lazy-loading enzyme it is possible to speed up tests execution time by 30-40% on the large codebase. I didn't notice any big improvement for the number of tests we maintain at the moment, but I thought it might have it in place in case we need it someday.

How Has This Been Tested?

Executed npm run test-unit and confirmed by Travis build.

Types of changes

New feature (non-breaking change which adds functionality)


  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

@gziolo gziolo self-assigned this Nov 21, 2017

@gziolo gziolo requested review from youknowriad, mtias, aduth and mcsf Nov 21, 2017


This comment has been minimized.

Show comment
Hide comment

gziolo Nov 23, 2017


This touches only test files, so it's safe to merge without review.


gziolo commented Nov 23, 2017

This touches only test files, so it's safe to merge without review.

@gziolo gziolo merged commit 300ca0a into master Nov 23, 2017

3 checks passed

codecov/project 35.76% remains the same compared to a76e229
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@gziolo gziolo deleted the add/snapshot-tests branch Nov 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment