question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Seems to be much slower than Mocha

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
kulshekharcommented, Jul 28, 2017

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

0reactions
GeeWeecommented, Aug 10, 2017

Guess there’s nothing more we can do here then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest runs 40 times slower than mocha - Stack Overflow
I'm currently setting it up mocha to work with typescript, and so far it's not very fast - it's freaking instantaneous. · Comparing...
Read more >
Terrible performance in Mocha Pro 2022 9.0.1 and After ...
Like you say, it seems like AE is sending the frames to Mocha slower than it should compared to AE 2021 and prior....
Read more >
[AskJS] Jest is so slow. Why Jest? : r/javascript - Reddit
We did a quick Mocha test, and it worked great. 0.4 seconds. Then I mentioned that the other big framework was Jest, but...
Read more >
Mocha plugin is extremely slow and sometimes crash...
When I launch Mocha, it takes a long time to load the footage (about 20 to 30 seconds). Then once it does load,...
Read more >
Speeding Up Your JavaScript Test Suite - Atomic Spin
Having fast tests is important. Slow running tests slow down development, especially if you're practicing TDD. If tests are too slow to run, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found