Skip to content

emilioSp/forget-about-jest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

forget-about-jest

Buy Me A Coffee

Unpopular opinion, forget about Jest! ๐Ÿ˜”

I'm very sad to say this, because I have used it a lot in the past, and for a long time I considered it the best framework to test Node.js applications.

Memory leaks

It suffers from serious memory leaks -> jestjs/jest#11956 This means that it is not suitable to be used with middle/big code repositories.

ESM issues

It doesn't fully support ESM -> jestjs/jest#9430 In the past, I was forced to transform a module in a static class simply because otherwise mocks didn't work.

Jest globals

The last straw is jestjs/jest#2549 Basically Jest VM differs from Node.js, but it is used to test Node.js applications. How can we consider it realiable? To prove this last point, simply clone this repo and execute:

npm run jest and then npm run assert and see with your own eyes that, inside Jest, a caught Error is not an instance of Error ๐Ÿ˜ต.

Thanks to Matteo Collina for sharing this https://www.twitch.tv/matteocollina/clip/CleverResourcefulFennelBabyRage-oGUFchiE1SAJIApU

Bonus track

Jest is slower compared to other test frameworks like TAP. x

Future ๐Ÿค”

If it is up to me I won't use Jest anymore to test Node.js applications. IMO we should embrace Node.js test framework shipped starting from v18 version ๐Ÿš€ ๐Ÿ‘‰ https://nodejs.org/docs/latest-v18.x/api/test.html

About

Pensieri e parole ๐ŸŽถ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published