Skip to content
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

Revert setRawMode on --watch quit (fixes #5028) #5029

Merged
merged 3 commits into from
Feb 14, 2018

Conversation

andyearnshaw
Copy link
Contributor

Summary

The issue is detailed in #5028. The summary is that it's not possible to force Jest to quite while the inspector is still open when the --watch parameter is provided.

Test plan

There currently aren't any tests (that I could see) for handling the q key or Ctrl-C/Ctrl-D, nor for the setup of stdin.setRawMode(true), so I didn't add any for this either. However, it's a simple 2 lines of code and only runs on quit, so it's unlikely to cause any unwanted side-effects.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@codecov-io
Copy link

codecov-io commented Dec 6, 2017

Codecov Report

Merging #5029 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5029      +/-   ##
==========================================
- Coverage   61.71%   61.68%   -0.04%     
==========================================
  Files         213      213              
  Lines        7149     7153       +4     
  Branches        4        4              
==========================================
  Hits         4412     4412              
- Misses       2736     2740       +4     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-cli/src/watch.js 72.46% <0%> (-1.07%) ⬇️
packages/jest-cli/src/plugins/quit.js 20% <0%> (-13.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 133a9a1...5d17782. Read the comment docs.

@SimenB SimenB requested a review from rogeliog December 9, 2017 08:43
@SimenB
Copy link
Member

SimenB commented Dec 17, 2017

@andyearnshaw This doesn't make any difference for me. ^C in watch mode prints Waiting for the debugger to disconnect... and when I refresh the chrome dev tool, it detaches. This is the same behavior with and without your change.

@andyearnshaw
Copy link
Contributor Author

@SimenB really? It fixed the problem for me. Can you post details about your environment please, so I can do some testing?

@andyearnshaw
Copy link
Contributor Author

@SimenB can you recheck this? The changes still work perfectly for me, switching off raw mode allows me to exit.

Is it possible that you only pressed Ctrl-C once? It's true that this still gives the message Waiting for the debugger to disconnect..., but then if you press Ctrl-C a second time it will force exit. Without my changes, it just hangs until you kill the debugger or the node process.

@cpojer
Copy link
Member

cpojer commented Feb 7, 2018

Yeah I'm gonna close this since it doesn't seem like anyone can reproduce it.

@cpojer cpojer closed this Feb 7, 2018
@SimenB
Copy link
Member

SimenB commented Feb 7, 2018

I'll take a final look today

@SimenB SimenB reopened this Feb 11, 2018
@SimenB
Copy link
Member

SimenB commented Feb 11, 2018

I tested this again, and @andyearnshaw is correct - without these changes, it's impossible to ^C out of a watching Jest when debugging.

@andyearnshaw mind rebasing on master? You'll need to update here as well: https://github.com/facebook/jest/blob/af191108302c719475aa34028a4ed46589b4cb9c/packages/jest-cli/src/plugins/quit.js#L12-L15

Also, please update the changelog

@andyearnshaw
Copy link
Contributor Author

andyearnshaw commented Feb 12, 2018 via email

@andyearnshaw
Copy link
Contributor Author

Should be good to go now. Thanks for taking another look.

@SimenB
Copy link
Member

SimenB commented Feb 14, 2018

Can you update the changelog as well, please? 🙂

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@cpojer cpojer merged commit 4ca959b into jestjs:master Feb 14, 2018
jessecarfb pushed a commit to jessecarfb/jest that referenced this pull request Feb 14, 2018
* Revert setRawMode on --watch ctrl-c (jestjs#5028)

* Disable stdin raw mode in watch quit plugin (jestjs#5028)

* Update changelog
@andyearnshaw andyearnshaw deleted the patch-1 branch February 14, 2018 12:11
@andyearnshaw
Copy link
Contributor Author

Thanks! 🙂

@github-actions
Copy link

This pull request 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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants