ts-jest: Seems to be much slower than Mocha

I currently use a testing setup for my projects that uses Mocha, ts-node, and nyc. In several of them I’ve tried switching to Jest. But ts-jest is consistently significantly slower 😢

I’ve added Jest to this project where you can see the difference.

These are the times I’m seeing in the project:

  • Current setup: time npm test 4.05 seconds
  • Jest: time npm run test-jest 12.34 seconds

Note that my tests themselves takes about 3-4 seconds. So Mocha adds a very small overhead where Jest is noticeably slower. I’ve tried in larger projects as well where the difference is even bigger.

For your convenience, here are the commands to reproduce:

git clone https://github.com/funkia/list
cd list
npm install
time npm test
time npm run test-jest

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I’ve posted a question on stackoverflow to see if we can get some help on this