DEV Community

Discussion on: Should I use Testing?

Collapse
 
gktim profile image
gkTim

Welcome!

With unit tests you can check pretty easily if the software is still working correctly when packages are updated and often you find bugs you didn’t notice before when writing tests. Also it often leads to a better architecture.

But if you have a lot of code already and want to be sure that all is working e2e tests can be the faster way to go. Like with playwright or cypress.

But in my opinion unit tests are worth the effort especially in JS projects with no typing. It take some time to add them when you haven’t done it from the start, but if you have done the initial work new unit tests are added fast.

Jest watch mode or wallaby.JS for the win.

Happy Coding!

Collapse
 
mikeyglitz profile image
mikeyGlitz

But if you have a lot of code already and want to be sure that all is working e2e tests can be the faster way to go.
Ideally you would want both unit tests and E2E tests. The unit tests verify functionality on a micro level. When I think of E2E tests, I picture starting the server up and running scripts which perform actions like sending API requests and validating the responses, or navigating to a web page and scraping the DOM to ensure everything is as expected.

Collapse
 
glitchcodes profile image
Vincent Tampos

I'm looking to learn jest / cypress but I haven't heard about wallaby.js, I'll look into it. Thanks!