diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bfcad66b879..fafb4dba528a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Fixes +* `[jest-cli]` Fix inability to quit watch mode while debugger is still attached + ([#5029](https://github.com/facebook/jest/pull/5029)) * `[jest-haste-map]` Properly handle platform-specific file deletions ([#5534](https://github.com/facebook/jest/pull/5534)) diff --git a/packages/jest-cli/src/plugins/quit.js b/packages/jest-cli/src/plugins/quit.js index 44e64941c4df..f3b2957141e1 100644 --- a/packages/jest-cli/src/plugins/quit.js +++ b/packages/jest-cli/src/plugins/quit.js @@ -10,6 +10,9 @@ import WatchPlugin from '../watch_plugin'; class QuitPlugin extends WatchPlugin { async showPrompt() { + if (typeof this._stdin.setRawMode === 'function') { + this._stdin.setRawMode(false); + } this._stdout.write('\n'); process.exit(0); } diff --git a/packages/jest-cli/src/watch.js b/packages/jest-cli/src/watch.js index ef55242c249b..67ab880b2ede 100644 --- a/packages/jest-cli/src/watch.js +++ b/packages/jest-cli/src/watch.js @@ -230,6 +230,9 @@ export default function watch( const onKeypress = (key: string) => { if (key === KEYS.CONTROL_C || key === KEYS.CONTROL_D) { + if (typeof stdin.setRawMode === 'function') { + stdin.setRawMode(false); + } outputStream.write('\n'); exit(0); return;