Menu

1 / 2

We Replaced Jest with Node's Built-in Test Runner in 12 Services — The 3 Lines of Code That Made It Possible

DEV Community: lambda·Dinesh_gowtham·5 months ago
#xbb7HibE
#dev#test#jest#built#runner
Reading 0:00
15s threshold

As we continued to scale our serverless architecture on AWS, our test suite had become a bottleneck. We needed a solution that would improve performance without sacrificing reliability. That's when we discovered Node.js 22's built-in test runner.

The Problem with Jest

We were using Jest for our testing needs, but it was slowing down our development process. The overhead of creating a new Jest instance for each test suite was significant, and we were seeing errors like Jest did not exit cleanly. An Asphalt configuration object must be provided or Error: ENOMEM: not enough memory .

// our previous jest config import { jest } from ' @jest/core ' ; import { configure } from ' @jest/config ' ;

configure ({ preset : ' ts-jest ' , testEnvironment : ' node ' , });

Enter fullscreen mode

Exit fullscreen mode

The memory overhead of Jest was a major concern for us, and we were seeing a significant increase in memory usage as our test suite grew.

Discovering Node's Built-in Test Runner

Node.js 22's built-in test…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.