TIL: Speed up jest tests (2)
Use esbuild-jest to speed up TypeScript tests
Toni PetrinaPublished on 2021-07-10•1 min read
Last time some jest.config.js
trickery was used to speed up Jest tests.
However, there is something that can make it faster - better compiler. And in this case it is esbuild.
First, add packages esbuild
and esbuild-jest
. Then add the following to jest.config.js
:
transform: {
"^.+\\.tsx?$": "esbuild-jest",
},
Also, remove preset: "ts-jest",
from jest.config.js
if found. From more than 3 seconds to 0.12s. Fantastic!