ctrl+c does not kill the process
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
If you use puppeteer in your tests like here
https://github.com/xfumihiro/jest-puppeteer-example
and hit ctrl+c
while tests are running the script will continue to run and it actually won’t quit by itself at that point. You need to kill
it.
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install
and yarn test
.
get https://github.com/xfumihiro/jest-puppeteer-example
yarn test
wait 2 or 3 seconds and ctrl+c
What is the expected behavior?
ctrl+c
should stop tests and terminate the process
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system. macOS 10.13.3 (17D102) node v8.1.2 yarn 1.1.0 tested with jest 22.0.0 and 22.4.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:10 (4 by maintainers)
Top GitHub Comments
I’ve cloned the provided repo, here is some additional information:
npm test
:ctrl+c
works (npm takes care of terminating the process).yarn test
:ctrl+c
does seems to print the tests again and act weirdly like in @rickhanlonii gif.jest
:ctrl+c
seems to stop the tests, continue the timer and a secondctrl+c
is terminating it. (gif added)Seems that it might be good to handle SIGINT in jest to verify termination.
@sjuchno @mgolawski jest does not exit the process on
ctrl+c
because puppeteer launcher is catching the SIGINT here in order to kill chrome. If you’ll try thehandleSIGINT
option on thesetup.js
scriptThe tests will terminate after
ctrl+c
but you’ll be left with an open chromium instance.I’ve opened a PR to puppeteer https://github.com/GoogleChrome/puppeteer/pull/2428 which should solve the issue and exit the process after killing the chrome instance.
Regardless of this case, we can still handle
SIGINT
in jest, which might also solve the bug from jest side for this and future use cases.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.