Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tests: Refactor tests to use only Jest API #1788
This is a follow up for #1382. This PR performs all remaining refactorings to get rid of Mocha specific code:
This change makes test execution a bit faster.
@nb This concludes Mocha to Jest migration for Gutenberg! This PR gives an overview how much code would be updated in the context of Calypso. Unfortunately sinon changes aren't covered with
# jest-codemods <file-path> # npm run lint -- --fix space-in-parens
referenced this pull request
Jul 7, 2017
Some minor revisions needed but overall I'm a fan. Can we now also remove
mocha: true from the eslint config?
@nylen Thanks for catching all issues introduced with
Let me know if that works for you until Jest adds a better way to do it.
I guess the best way would be to refactor this code to use snapshots instead. We can do it in the follow up PR.
What’s your thinking about what tests should use snapshots? A lot of the tests touched in this PR should better stay the way they are. Converting component and fixture tests to snapshots would be awesome, though. Agreed that a separate PR is better.
Yes, it makes perfect sense.
@nb I rather consider snapshot testing as complementary. When you develop component, you should also use TDD techniques and introduce snapshot based tests once you have something working to make sure it doesn't change later. Definitely tests where you create tons of fixtures are perfect match to use snapshots, too.
Jul 10, 2017
Let's see how it goes. I don't have any experience with snapshots so I'm only blindly predicting :D