DEV Community

Cover image for Testing hell 😱. Honest question. How do you survive? What's your secret?
OpenSource
OpenSource

Posted on

Testing hell 😱. Honest question. How do you survive? What's your secret?

We've just spent the worst couple of hours trying to work with Jest with SVG, nanoid, ... Anything that's slightly out of the ordinary Jest won't work and we found out we were spending more time debugging Jest than debugging our code. So... please help us. How do you survive the testing hell??

Top comments (12)

Collapse
 
ben profile image
Ben Halpern

If You're Going Through Hell, Keep Going

- Winston Churchill

Does that help you? πŸ™ƒ

Collapse
 
opensourcee profile image
OpenSource • Edited

Lol. I'm more tempted of turning around and never testing again!

Collapse
 
best_codes profile image
Best Codes

What languages are you writing and testing in? I've used Jest (barely). Have you tried anything besides Jest? I might have to play around with this...

Collapse
 
opensourcee profile image
OpenSource

We're using React. Tried Cypress and the experience is 10000x better. But Cypress is more e2e. I was looking for a unit test and integration test library. Jest is by far one of the most recommended. I really don't know how. It's a pain...

Collapse
 
codewithcaen profile image
CodeWithCaen

Frontend testing can be hard; but oftentimes when you're having issues writing tests, it's because something is wrong with your code. Poorly designed architectures are hard to test, especially when they stray from the conventions the testing frameworks are designed for.

Collapse
 
kurealnum profile image
Oscar

Frontend testing is... yeah, I understand your pain. I try and make it a habit and do it consistently, so I'm not having to write a whole bunch of tests all at once. But still, I have an entire file that isn't tested because MSW and Vitest simply refuse to cooperate with each other :p

Collapse
 
hilleer profile image
Daniel Hillmann

Is there any chance that maybe you are holding it wrong? Try opening a stackoverflow ticket! Personally I have had mostly joy of Jest and not framework specific issues. For my use cases there have been great documentation as well as community posts about all the questions I have been looking for. Mostly, at least.

Collapse
 
lexlohr profile image
Alex Lohr

Check out testing-library, stop testing implementation details like SVGs, maybe really consider switching to vitest.

Collapse
 
gregorygaines profile image
Gregory Gaines

Testing that's slowing you down is better than writing code with no tests and moving fast.

10/10 times

Collapse
 
musabdev profile image
Musab

Simple, just don't write tests.

Collapse
 
falkz profile image
FalkZ

Have you tried vitest (vitest.dev/)?
IMO the easiest and fastest way to do unit tests :). But if your trying to do sth. very niche, there might only support for it in jest…

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Barely used any automated testing in 30 years... and it's never been a problem.