-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Support processing keypress by watcher for non-tty stdin #5282
Comments
Have you found #5017 @segrey? We've been discussing this for vscode-jest and @Raathigesh's Majestic. It seems like a high-risk messy effort to separate the IO method from the package (jest-cli?), so I've been considering using a hackish #5242 discussed using the |
Oops, missed #5017, sorry about the duplicate. Thanks @seanpoulter.
Sorry, not sure I understand it fully. What IO method is subject for separation here? AFAIU, your suggested change in #5017 is what's exactly needed for tools that run jest with piped stdin. Yeah, hackish
Nope, |
Sorry, that isn't clear at all. What I meant to say is, there's a lot of logic in
It sure can. The way I understood it, if we're handling input from non-raw terminals we'll have to split the stream to be one character at at time. It's not a technical challenge, but I'm not sure how you'd handle signals, unicode characters, etc.. Thanks for confirming |
Thanks, now I see your point about separating IO methods from
Yeah, splitting the stream to one character is not great. Maybe tools can do this work on their own and Jest can avoid splitting the stream. E.g. here is how IntelliJ integration sends input to Jest:
Regarding handling signals, explicitly sent signals (via |
I'm all smiles. Thanks for sharing that, and let's build this with the expectation that folks send the right things in their piped |
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. |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Currently, when jest is running with non-tty stdin, "Watch Usage" is printed:
However, no typed characters are processed (e.g.
f
,o
,p
,t
,q
, Enter). This is happening, because watcher registers keypress event handler ifprocess.stdin.setRawMode
is defined (https://github.com/facebook/jest/blob/v22.0.5/packages/jest-cli/src/watch.js#L311), and for non-tty stdinprocess.stdin.setRawMode
is not defined.What is the expected behavior?
Would be great to allow processing stdin for non-tty stdin too. E.g. make
process.stdin.setRawMode(true)
optional.Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
jest: 22.0.5
node: 9.2.1
The text was updated successfully, but these errors were encountered: