Do you want to request a feature or report a bug? A feature
What is the current behavior?
When Jest runs in watch mode, jest-cli only listens for input from text terminals that send characters one at a time in "raw mode". This dependency on tty.ReadStream#setReadMode in jest/packages/jest-cli/src/watch.js prevents anyone who's spawned Jest as a child process from interacting with the watcher (e.g.: IDE extensions like vscode-jest).
What is the expected behaviour?
How do you feel about using setRawMode when it's available, and letting whatever data through if a feature toggle is set (e.g.: a CLI arg or process.env)? Any thoughts on the feature toggle?
Suggested change:
From:
if (typeof stdin.setRawMode === 'function') {
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('hex');
stdin.on('data', onKeypress);
}
To:
const useRawInput = typeof stdin.setRawMode === 'function';
if (useRawInput) {
stdin.setRawMode(true);
}
if (useRawInput || roughEdgeFeatureToggle) {
stdin.resume();
stdin.setEncoding('hex');
stdin.on('data', onKeypress);
}
On my end it's the lowest overhead of:
- using
stdin that's piped in
- kill/respawn Jest processes when things in the "globalConfig" change
- refactor
watch.js to extract the dependency on input method
Thanks!
Do you want to request a feature or report a bug? A feature
What is the current behavior?
When Jest runs in watch mode,
jest-clionly listens for input from text terminals that send characters one at a time in "raw mode". This dependency ontty.ReadStream#setReadModeinjest/packages/jest-cli/src/watch.jsprevents anyone who's spawned Jest as a child process from interacting with the watcher (e.g.: IDE extensions likevscode-jest).What is the expected behaviour?
How do you feel about using
setRawModewhen it's available, and letting whatever data through if a feature toggle is set (e.g.: a CLI arg orprocess.env)? Any thoughts on the feature toggle?Suggested change:
From:
To:
On my end it's the lowest overhead of:
stdinthat's piped inwatch.jsto extract the dependency on input methodThanks!