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: Migrate client side tests from Mocha to Jest #16119
Similar to #14364 where we migrate server side tests to Jest. This one turned out to be huge :)
It takes 50-60 seconds on average to complete full tests run on MBP 2015. It is a bit slower on first run, because Jest bootstraps some nice caching mechanisms to speed up things on subsequent runs.
It is faster than with what we have with Mocha at the moment:
I have some memory issues which Mocha on my machine, so this test result might be inaccurate. It still takes 10 seconds more to process all tests if we skip Mocha shutdown phase. I'm not even mentioning that Jest works properly all the time and doesn't error at all!
There is still one test that doesn't work with Jest, but we should rather remove it completely, because it's too complex.
This PR enables to use Jest test runner in place of Mocha. To make transition smoother and this already huge PR a bit smaller we still keep
With this PR we are also removing no longer needed test helpers:
At the end of full migration we will be able to remove also:
In the long run we could get rid of all remaining helpers. This is going to be possible because Jest provides isolation between test files.
How to run tests
I updated over 160 tests, skipped 57 tests to make full test run green. I think we can manually convert 99% of skipped tests and it seems like I can do it myself during my parental leave with the very limited time spent at the computer. I removed
One more note, it looks like execution time locally should be about the same to what we have at the moment once I introduce all performance optimizations I found online.
I was able to speed up execution of all tests from ~90 to ~50 seconds by using this code shared by @gdborton. It works like a charm for both
We have still 54 test suites to updated or remove completely :)