New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow (more than 2 min) tests #857

scabbiaza opened this Issue Apr 1, 2016 · 4 comments


None yet
2 participants

scabbiaza commented Apr 1, 2016


I'm facing problem with super slow test running in jest.
I have noticed, that one simple test can take about 2 min.
Next time it will work faster, but if I change code in the test file, I have to wait again about 2 min.

I tried jest-cli version 0.9 and 0.10: no difference, both slow.
Also when I run test with --watch, it stuck.

My environment
node: v4.4.0
npm: 2.14.20


"devDependencies": {
    "babel-jest": "^9.0.1",
    "jest-cli": "^0.10.0"
  "scripts": {
    "test": "NODE_ENV=test jest"
  "babel": {
    "presets": [
    "plugins": [
  "jest": {
    "testFileExtensions": [
    "testPathDirs": [
    "moduleFileExtensions": [
    "unmockedModulePathPatterns": [

Example of test

describe("Test", function() {
  it("simple", function () {


Using Jest CLI v0.10.0, jasmine2, babel-jest
 PASS src/scripts/__tests__/app/helpers/test.js (120.947s)
1 test passed (1 total in 1 test suite, run time 130.6s)

Do you have any ideas why it can happen?


This comment has been minimized.


cpojer commented Apr 4, 2016


This is most definitely not normal and I'm unable to reproduce this locally. If this happens only on the first run, it most likely means that your babel configuration is messed up and that babel is doing something that it should not. On the first run, babel transforms all files under test.

Your package.json specifies a bunch of presets for babel, they don't however seem to be installed. I recommend reading up on the babel documentation here:

To prove that this is indeed a babel problem, I recommend doing rm -rf node_modules/babel-jest and then running Jest – if the test runs significantly faster (less than 1s as expected), it is definitely a babel problem. Your test file doesn't currently seem to use any babel transforms either.

I'm closing this because it's unlikely that it is a Jest issue, but happy to reopen if it turns out to be related to Jest.

@cpojer cpojer closed this Apr 4, 2016


This comment has been minimized.

scabbiaza commented Apr 4, 2016

Thank you. I think you are right! After i deleted babel-jest, it works very fast. Will investigate more how to solve it. Thanks again.


This comment has been minimized.

scabbiaza commented Jul 7, 2016

Just for the history: the reason was in the slow hard drive.
After "million" experiments with different node modules (installation/deinstallation), my drive was completely fragmented. After defragmentation everything works quickly.

P.S. Using OS X, NOT SSD.


This comment has been minimized.


cpojer commented Jul 7, 2016

Thank you for the update! That's definitely reassuring :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment