7

I got Jest working in my environment, but I'm fairly certain that it's running way slower than it's supposed to.

Currently, I'm just running 2 tests that are copied from the Jest intro tutorials. One is a simple sum function, and another is a simple checkbox example using Enzyme. They take on average about 10 seconds until they start running (showing Determining test suites to run... for that time), and then about another 10 seconds from that point onwards (once the timer starts). This seems absurdly long for such simple components...

I tried setting my testEnvironment to node to speed things up, but it hasn't made much of a difference.

So accordingly:

1) Is this normal?

2) If not - what can cause Jest to slow down like this?

Some potential factors?

1) I am running these tests within a larger React project that contains ~20 or so react components, but none of them are being referenced by any of the tests - so I don't think they should be impacting this. =/

2) I'm using the fileName.test.js naming system to let Jest know where the test files are, instead of putting everything in a __tests__ folder as per the tutorials.

thisissami
  • 15,445
  • 16
  • 47
  • 74
  • did you have success fixing this issue? – Pouya Sanooei Aug 24 '17 at 22:05
  • Not with this environment, no. But the next ReactJS project I worked on where I also used Jest did not have this issue. It was a much simpler project. I still don't understand what was wrong in the first environment - I believe it was a bug in Jest, and have seen on GitHub issues that many people have had the same problem. – thisissami Aug 28 '17 at 08:09
  • have you tried https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-and-or-continuous-integration-ci-server or disabling `automock`? – skyboyer Oct 21 '18 at 07:34

0 Answers0