DEV Community

Cover image for What's your favorite JS testing framework?

What's your favorite JS testing framework?

Madza on September 27, 2021

Nowadays, the industry is dominated by agile development and tight deadlines. Manual unit testing can be complex and time-consuming, so it makes se...
Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the valuable insight ๐Ÿ’ฏ๐Ÿ‘โœจ

Collapse
ย 
ben profile image
Ben Halpern โ€ข

We use Jest, and I've been pretty happy with it overall. I'm not so deep into this type of work any more, but every time I need something I find it easy enough to follow along with what I'm seeing in the files and/or find useful docs and guides.

Collapse
ย 
madza profile image
Madza โ€ข

I still remember reading your post on the DEVs tech stack and I was impressed seeing all the pieces working together so well ๐Ÿ˜‰
Jest has proven itself as a solid framework, with lots of devs trusting it.
According to npmtrends:
Img stats

Collapse
ย 
ben profile image
Ben Halpern โ€ข

We've since simplified the tech stack a little bit, but yes we have had a focus on maintaining a good test suite and having the tools that support stability as much as we can.

Collapse
ย 
peerreynders profile image
peerreynders โ€ข โ€ข Edited

Slow Tests

The tests take long enough to run that developers don't run them every time they make a change to the system under test (SUT). They wait until the next coffee break or other interrupt before running them. Or, whenever they run the tests they walk around and chat with other team members (or play Doom or surf the Internet or ...)

i.e. your test runner shouldn't be part of the problem - that's why uvu exists.

Collapse
ย 
madza profile image
Madza โ€ข

This is insightful, thanks ๐Ÿ‘๐Ÿ˜‰

Collapse
ย 
ashoutinthevoid profile image
Full Name โ€ข โ€ข Edited

I use tape for most purposes. Simple, lightweight, works as well today as it did years and years ago. It's also very similar to Rust's built-in test runner, so when I move between languages the context switch is that much lighter.

I also personally dislike the bdd test style (thus I wouldn't use a framework that only provides that option, assuming the choice is mine). Not for any technical reasons that actually matter, just personal taste. So much noise for the same results.

Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the input ๐Ÿ‘๐Ÿ˜‰

Collapse
ย 
mage_ai profile image
Mage AI โ€ข

We use React on our frontend, so Jest and Enzyme are our preferred JS testing frameworks. Since these are quite popular, there are also a lot of great resources out there on using them, and Jest is even recommended in React's docs.

Collapse
ย 
siddharthshyniben profile image
Siddharth โ€ข

Jest for now, though I'm building my own!

I try to build my own <everything>. I'm building my own framework, my own ghost, my own programming language, etc.

Collapse
ย 
madza profile image
Madza โ€ข

Awesome to hear, best of luck in you projects ๐Ÿ‘๐Ÿ˜‰

Collapse
ย 
fredericbonnet profile image
Frรฉdรฉric Bonnet โ€ข

For unit tests my favorite combo is Mocha/Chai, plus Sinon if I need mocks (though it's rarely the case for unit testing). For dev E2E I'm a big fan of CodeceptJS, far superior to Cypress IMHO.

Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the insight ๐Ÿ™โค

Collapse
ย 
vonheikemen profile image
Heiker โ€ข

ava is the one I like the most. Very similar to tape but adds some convenient features.

Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the input ๐Ÿ™โค

Collapse
ย 
jcubic profile image
Jakub T. Jankiewicz โ€ข โ€ข Edited

I use Jest and Ava, Ava was the only framework that allow async tests loading, so it was the only option for my Scheme interpreter.

Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the input ๐Ÿ™โค

Collapse
ย 
joelbonetr profile image
JoelBonetR ๐Ÿฅ‡ โ€ข

The QA dept. ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚

Collapse
ย 
madza profile image
Madza โ€ข

Haha, made my day ๐Ÿ˜„๐Ÿ˜„

Collapse
ย 
andrewbaisden profile image
Andrew Baisden โ€ข

Jest, Enzyme, React Testing Library and Cypress.

Collapse
ย 
madza profile image
Madza โ€ข

Thanks for the input ๐Ÿ™โค

Collapse
ย 
knopkem profile image
Michael Knopke โ€ข

Cypress. But only for frontend testing (integration testing is awesome), jest for backend, nodejs testing.

Collapse
ย 
madza profile image
Madza โ€ข

Oh, yeah, heard about that too ๐Ÿ˜‰๐Ÿ‘