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
merged 1 commit into from Nov 23, 2017

Conversation

Projects
None yet
1 participant
@gziolo
Member

gziolo commented Nov 21, 2017

Description

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)

Checklist:

  • 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

@gziolo

This comment has been minimized.

Show comment
Hide comment
@gziolo

gziolo Nov 23, 2017

Member

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

Member

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
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@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