Ask HN: Jest is so slow. Why Jest?
5 comments
Huh, we're using Jest with Vue and Typescript, and I've always assumed that Vue setup and Typescript transpilation were the heavy parts. We have far fewer tests than I'd like, and still the tests suite takes more than a minute to run.
First thing tomorrow I'm looking into other test runners. Thank you for sharing this!
First thing tomorrow I'm looking into other test runners. Thank you for sharing this!
Clickable link from the submission https://github.com/artemave/node-test-runners-benchmark
I did a comparison of Ava, Mocha, and Jest test runners: https://github.com/scraggo/comparing-javascript-test-runners
Jest is the slowest if running tests in parallel with Mocha >=8. Mocha is the slowest in its default serial mode.
My conclusion with Jest was this:
"Jest is recommended if you want to get tests up and running quickly. It has everything built in and requires very little configuration. The command line and GUI experience is unmatched. Finally, it's the most popular and makes an excellent pair with React."
Jest is the slowest if running tests in parallel with Mocha >=8. Mocha is the slowest in its default serial mode.
My conclusion with Jest was this:
"Jest is recommended if you want to get tests up and running quickly. It has everything built in and requires very little configuration. The command line and GUI experience is unmatched. Finally, it's the most popular and makes an excellent pair with React."
I think jest uses a JSDOM environment per default in order to stimulate certain APIs.
Might be sensible to compare the node environment to the others if you do not need browser APIs in your tests. And this might be the reason for picking it, frameworks just working g out of the Box.
Personally it doesn’t matter too much as we have too many tests to run all of them locally all the time anyhow.
Might be sensible to compare the node environment to the others if you do not need browser APIs in your tests. And this might be the reason for picking it, frameworks just working g out of the Box.
Personally it doesn’t matter too much as we have too many tests to run all of them locally all the time anyhow.
What if we had the concept of annotations in JavaScript? That way I could ask for the dom environment if I needed it in my test or if I don't reject it entirely.
I'd really love to hear from people who, given a green light on tech choices, would pick Jest over, say, mocha or tape for their next project. Thank you!
[1] https://github.com/artemave/node-test-runners-benchmark