Jest ESM — Total Guide To More Than 100% Faster Testing For Angular⚡

Tomas Trajan
15 min readJan 10, 2023

Let’s learn how to speed up our Angular Jest tests by more than 100% by switching to Jest ESM (a notoriously problematic migration) and how to solve all the troublesome issues that tend to pop up along the way!

Idea, Prompts, Composition & Design by Tomas Trajan, Gen by MindJourney

In my case, the final speed up was close to 290% from 50 seconds to only 17 seconds which is a huge win!

Jest is by far the most popular frontend test runner and for a good reason!

NPM downloads

Jest runs tests in parallel and we can even specify how many workers should be used to match the cores of our machine, which makes it really fast!

For these reasons, Jest became the go to replacement for the Karma test runner which comes out of the box in Angular CLI workspaces.

This article focuses on Jest ESM integration in standard Angular CLI workspaces using plain jesttogether with jest-preset-angular. There…

--

--

Tomas Trajan

👋 I build, teach, write & speak about #Angular & #NgRx for enterprises 👨‍💻 Google Developer Expert #GDE 👨‍🏫 @AngularZurich meetup co-organizer