Isolate tests and run in parallel

Jest makes it easy to isolate your unit tests in a sandboxed environment. In other words, side-effects from running one test cannot impact the results of other tests. Each time a test run completes, the global environment is automatically reset for the next. Since tests are standalone and their execution order doesn't matter, Jest runs tests in parallel. This means that even if you have hundreds of unit tests you can run them frequently without the fear of having to wait.

Here's an illustration of how Jest runs tests in parallel, in their own isolated environment:

The best part is that Jest handles scaling processes up for you. For example, if you're just starting out and your project only has a handful of unit tests, Jest isn't going to spawn, for example, eight parallel processes. It will just run them in a single process. The key thing for you to remember is that unit tests are their own universe with no interference from other universes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.117.109