Jest: Unable to quit watch mode when it hits an infinite loop

Created on 27 Oct 2016  路  2Comments  路  Source: facebook/jest

Do you want to request a _feature_ or report a _bug_?
bug

What is the current behavior?
When using watch mode, if there is an infinite loop in a test, you cannot exit with Ctrl-C (I'm using iTerm2 on Mac).

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.
Go to this repo, npm install, and npm test -- --watch.

What is the expected behavior?
Since watch mode runs on every save, I've encountered situations where I accidentally saved an infinite loop, and watch mode gets stuck, and doesn't take any keyboard input to quit, continue, etc. It seems like there could be a way to handle this without having to completely close that tab in my terminal. When running normally outside of watch mode, you can Ctrl-C to stop the run if you hit an infinite loop.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

npm version = 3.8.6
node version = v5.12.0
jest version = 16.0.2
test framework = jasmine2
config = {
  "rootDir": "/Users/William/Desktop/jest-hangs-repro",
  "name": "-Users-William-Desktop-jest-hangs-repro",
  "setupFiles": [],
  "testRunner": "/Users/William/Desktop/jest-hangs-repro/node_modules/jest-jasmine2/build/index.js",
  "scriptPreprocessor": "/Users/William/Desktop/jest-hangs-repro/node_modules/babel-jest/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/var/folders/7q/dcp7nbqx7lv7v_jwstp2mwh40000gn/T/jest",
  "clearMocks": false,
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "globals": {},
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "moduleNameMapper": {},
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "preprocessorIgnorePatterns": [
    "/node_modules/"
  ],
  "resetModules": false,
  "testEnvironment": "jest-environment-jsdom",
  "testPathDirs": [
    "/Users/William/Desktop/jest-hangs-repro"
  ],
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": true,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}

Most helpful comment

What is the status on this?

All 2 comments

The conditions that most-commonly created the stalled Jest issue should be addressed in 17.0.2.

What is the status on this?

Was this page helpful?
0 / 5 - 0 ratings