DEV Community

Discussion on: Adding Jest tests to a project

Collapse
 
lexlohr profile image
Alex Lohr

While jest is full of features, it is also rather large, opinionated and slow. If you need the same features, you should consider vitest and if you can do without and want your tests to run even faster, try uvu.

Also, good example on how to break your tests. Make sure every test is red at least once to avoid false positives.

Collapse
 
peerreynders profile image
peerreynders

I think SvelteKit adopted uvu.

I suppose Solid.js is using Jest simply because of contributor skill prevalence.

A pet hypothesis of mine is that Jest's feature set encourages testing to drift from "microtesting" to "integrated testing" (should be covered by end-to-end testing) which fails to impose the correct design pressures on the components.

Collapse
 
lexlohr profile image
Alex Lohr • Edited

Solid-start (basically Solid's SvelteKit) is currenlty planning its test suite; since I'm the resident Solid.js unit testing guy, I suggested either uvu or vitest.

Update: vitest it is.

Collapse
 
jakecarpenter profile image
Jake Carpenter • Edited

Thanks for bringing my attention to vitest. Iā€™m going to take a look at it to see if it can replace jest in our Expo RN project. Jest-expo has a ton of problems.

Collapse
 
dailydevtips1 profile image
Chris Bongers

Nice tip!

I'll write it on my research list, sounds pretty amazing.
Does it easily switch from Jest to vitest?

Collapse
 
lexlohr profile image
Alex Lohr

The API is the same and the configuration is similar to vite and really simple.