4 ms·
For testing, I've been exploring vitest which is missing from this list because jest looks unmaintained and has growing pain with typescript and esm support. h
by searchableguy 5y ago
For testing, I've been exploring vitest which is missing from this list because jest looks unmaintained and has growing pain with typescript and esm support.
https://vitest.dev/ https://vitest.dev/
It's a drop in replacement for jest. The only change you will need to make in most cases is adding an explicit import for expect, describe, and it. It works without any config with esm and typescript.
It's also 5x faster in development.
It integrates well with vite which is the bundler I use.
- samuelstros 5y agoVitest is on the list with highest satisfaction after the testing library :)
- searchableguy 5y agoAh, I missed it on mobile.
- ArcMex 5y ago>because jest looks unmaintained Help me understand what you meant by this? https://github.com/facebook/jest https://github.com/facebook/jest
- searchableguy 5y agoRecent commits are not an indicator for a healthy package. There are many unfixed issues and PRs sitting there because there is a single maintainer handling all of it (which is very understandable and I'm grateful for all the work) https://github.com/facebook/jest/pull/11529#issuecomment-1027152470 https://github.com/facebook/jest/pull/11529#issuecomment-102...
- madeofpalk 5y ago> has growing pain with typescript and esm support. I'm curious - what do you mean by this? Been using Jest in multiple codebases with typescript and ES Modules and never ran into an issue.
- brundolf 5y agoMy experience has been that basically every time you need to change your Babel/typescript/webpack configuration you have to do it a second time, with a different set of quirks and constraints, for Jest. It's not a blocker but it's a persistent pain
- rattlesnakedave 5y agoI remember having trouble with this recently. No specific examples to cite because I gave up and nuked the project, but support for ESM is experimental in Jest. I literally just couldn't get it to work with ES6. I remember thinking I would have to compile to CJS so jest would work. edit: just found this, which seems to confirm my anecdotal xp of esm in jest being weird https://github.com/facebook/jest/pull/11529#issuecomment-1027091448 https://github.com/facebook/jest/pull/11529#issuecomment-102...
- grissius 5y agoI've been doing some benchmarks recently and actually it is not that fast, compared to Jest. It seems to have solved the Jest unforgivable memory leaks, but overall has much greater memory consumption. https://github.com/grissius/jest-is-a-rude-needy-clown-and-eats-lot-of-memory https://github.com/grissius/jest-is-a-rude-needy-clown-and-e...
- searchableguy 5y agoThat is due to ESM. You aren't testing the same thing in your jest and vitest test. Enable experimental support for esm in jest, change your test suite template, and run it. I'm sure that causes the bottleneck for vitest but it's a necessary evil as ecosystem moves toward ES module and no global context across tests. You can also speed up vitest by changing config to make it behave similar to jest, I think.
- grissius 5y agoI tried using the globals, but it does not have much affect, so I don't think ESM has that much to do with it, see results here: https://github.com/grissius/jest-is-a-rude-needy-clown-and-eats-lot-of-memory/issues/1#issuecomment-1060326193 https://github.com/grissius/jest-is-a-rude-needy-clown-and-e... The benchmark covers several different scenarios, and memory and time efficiency leans more towards Jest (which is already pretty bad as it is), so I don't think it is fair to declare "A blazing fast". The project looks promising (appreciate ESM and TS support), don't get me wrong, but speed is not its strength.