Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jest hangs indefinitely, runs no tests

Every time I run jest it never runs anything. I have let the counter go arbitrarily high. I have run jest with --no-cache

jest --debug output is as follows:

{   "configs": [     {       "automock": false,       "browser": false,       "cache": true,       "cacheDirectory": "/var/folders/7v/64n1tsk11zs2pbwf5bm_c9kc0000gn/T/jest_dx",       "clearMocks": false,       "coveragePathIgnorePatterns": [         "/node_modules/"       ],       "detectLeaks": false,       "forceCoverageMatch": [],       "globals": {},       "haste": {         "defaultPlatform": "ios",         "platforms": [           "android",           "ios",           "native"         ],         "providesModuleNodeModules": [           "react-native"         ]       },       "moduleDirectories": [         "node_modules"       ],       "moduleFileExtensions": [         "js",         "json",         "jsx",         "node"       ],       "moduleNameMapper": [         [           "^React$",           "/Users/skilurus/github/flock-react-app/node_modules/react"         ]       ],       "modulePathIgnorePatterns": [         "/Users/skilurus/github/flock-react-app/node_modules/react-native/Libraries/react-native/"       ],       "name": "b29a126b130a0be47202d3bc7b00f1b4",       "resetMocks": false,       "resetModules": false,       "restoreMocks": false,       "rootDir": "/Users/skilurus/github/flock-react-app",       "roots": [         "/Users/skilurus/github/flock-react-app"       ],       "runner": "jest-runner",       "setupFiles": [         "/Users/skilurus/github/flock-react-app/node_modules/regenerator-runtime/runtime.js",         "/Users/skilurus/github/flock-react-app/node_modules/react-native/jest/setup.js",         "/Users/skilurus/github/flock-react-app/test-setup.js"       ],       "snapshotSerializers": [         "/Users/skilurus/github/flock-react-app/node_modules/enzyme-to-json/serializer.js"       ],       "testEnvironment": "/Users/skilurus/github/flock-react-app/node_modules/jest-environment-jsdom/build/index.js",       "testEnvironmentOptions": {},       "testLocationInResults": false,       "testMatch": [         "**/__tests__/**/*.js?(x)",         "**/?(*.)(spec|test).js?(x)"       ],       "testPathIgnorePatterns": [         "/node_modules/",         "e2e"       ],       "testRegex": "",       "testRunner": "/Users/skilurus/github/flock-react-app/node_modules/jest-jasmine2/build/index.js",       "testURL": "about:blank",       "timers": "real",       "transform": [         [           "^.+\\.js$",           "/Users/skilurus/github/flock-react-app/node_modules/babel-jest/build/index.js"         ],         [           "^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$",           "/Users/skilurus/github/flock-react-app/node_modules/react-native/jest/assetFileTransformer.js"         ]       ],       "transformIgnorePatterns": [         "node_modules/(?!react-native|native-base|react-navigation|react-native-fabric|tipsi-stripe)"       ],       "watchPathIgnorePatterns": []     }   ],   "globalConfig": {     "bail": false,     "changedFilesWithAncestor": false,     "collectCoverageFrom": [       "src/**/*.{js,jsx}"     ],     "coverageDirectory": "/Users/skilurus/github/flock-react-app/__coverage__",     "coverageReporters": [       "json",       "lcov",       "text"     ],     "coverageThreshold": {       "global": {         "branches": 70,         "functions": 75,         "lines": 85,         "statements": 80       }     },     "detectLeaks": false,     "expand": false,     "globalSetup": null,     "globalTeardown": null,     "listTests": false,     "mapCoverage": false,     "maxWorkers": 7,     "noStackTrace": false,     "nonFlagArgs": [],     "notify": false,     "notifyMode": "always",     "passWithNoTests": false,     "rootDir": "/Users/skilurus/github/flock-react-app",     "runTestsByPath": false,     "testFailureExitCode": 1,     "testPathPattern": "",     "testResultsProcessor": null,     "updateSnapshot": "new",     "useStderr": false,     "verbose": true,     "watch": false,     "watchman": true   },   "version": "22.3.0" } 

node --version: 8.9.4

npm --version: 5.6.0

yarn --version 1.3.2

Has anybody seen anything similiar? Does anybody know hot to fix this?

like image 727
Abraham P Avatar asked Feb 17 '18 21:02

Abraham P


People also ask

Does jest run tests concurrently?

By default, Jest will parallelise tests that are in different files. IMPORTANT: Paralellising tests mean using different threads to run test-cases simultaneously. Figure 2.

What is jest setTimeout?

setTimeout(timeout) Set the default timeout interval for tests and before/after hooks in milliseconds. Note: The default timeout interval is 5 seconds if this method is not called. Example: jest.


1 Answers

This happens to me too but it's intermittent, very frustrating though. I have discovered a workaround which is to run using the --runInBand flag, which just runs tests in the same thread:

jest --runInBand 
like image 171
dst Avatar answered Oct 02 '22 17:10

dst