Why Is My Jest Suite So Slow?

<p>Our team is a couple of months into developing a new application, and our suite of unit 240 tests takes 46 seconds to run. That duration is not excessive yet, but it&rsquo;s increasing in proportion to the number of tests. In a couple of months, it&rsquo;ll take a couple of minutes to run our tests.</p> <p>We were surprised by this, as Jest is known for its fast performance. However, while Jest reported that each test only took 40ms, the overall run time for each test was closer to 6 seconds.</p> <p>The integration tests for one of our legacy applications fare even worse, taking around 35 seconds for a single test. This time puts it over the duration where the mind starts to wander, and it&rsquo;s hard to focus on developing the tests. With each actual test only taking about a second, where is all the extra time going?</p> <p>Over the past couple of weeks, I&rsquo;ve fallen down a bit of a rabbit hole trying to figure out why our test suite is so slow. Unfortunately, there are a lot of ideas out there to sort through, and few of them had any impact. Further, there doesn&rsquo;t even seem to be much of a consensus on how fast our tests&nbsp;<em>should</em>&nbsp;be.</p> <p><a href="https://blog.bitsrc.io/why-is-my-jest-suite-so-slow-2a4859bb9ac0">Click Here</a></p>
Tags: Jest Suite