Jest performance is at best 2x slower than Jasmine, in our case 7x slower
See original GitHub issueš Bug Report
Weāve been using Jest alongside Jasmine for the same test suite for about a year now. We love Jest because itās developer experience is superb, however, on our very large monorepo with ~7000+ test specs, Jest runs about 7 times slower than Jasmine. This problem has been getting worse and worse as the test suite grows and as a result, we always run our test suite via Jasmine and only use Jest for development --watch mode.
We would ā„ to use Jest as our only test runner, but its poor performance is preventing us from doing so. Having to run both Jest and Jasmine runners requires painful CI setup and constant upkeep of the Jasmine environment setup (which is much more complex than Jestās).
Iād like to better understand why the performance difference is so significant and if thereās anything that can be done to optimize it.
To Reproduce
Iāve created a very detailed project to reproduce and profile both Jest and Jasmine on the same test suite in this project: https://github.com/EvHaus/jest-vs-jasmine
The environment is the same. The configurations are very similar. Both use JSDom. Both use the same Babel setup. Additional instructions are contained therein.
Expected behavior
Running tests through Jest should ideally be as fast as running them through Jasmine.
Link to repl or repo (highly encouraged)
https://github.com/EvHaus/jest-vs-jasmine
Run npx envinfo --preset jest
Tested on a few different platform. See https://github.com/EvHaus/jest-vs-jasmine README for more info.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:167
- Comments:42 (10 by maintainers)
Top GitHub Comments
Same issue here on 25.2.2, file resolution takes too long. Is there any plan to speed it up?
i was trying to do migration from mocha to jestā¦ andā¦ mocha is finishing all tests before jest starts first oneā¦ i think there is somewhere issue with resolving/reading files -> my project contains ~70k files, and iām running ~19k tests.
after some digging its looks like jest is trying to import all files from all folders before he starts tests, iām providing explicit match for test file:
testMatch: ['<rootDir>/dist/alignment.spec.js']
.i was able to run tests by adding to jest.config
but itās still 11mā¦ as opposed to mocha ~1m and without test framework (try/catch assert) ~40-50s
turning off transformation helped to
so far my configuration looks like this:
its still slow, ~4min
now iām looking for way to turn of prettier, i donāt care about formatting errorsā¦