-
-
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
Treat dumb terminals as noninteractive #5237
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5237 +/- ##
=======================================
Coverage 61.18% 61.18%
=======================================
Files 202 202
Lines 6765 6765
Branches 3 4 +1
=======================================
Hits 4139 4139
Misses 2625 2625
Partials 1 1
Continue to review full report at Codecov.
|
@@ -1,3 +1,3 @@ | |||
import isCI from 'is-ci'; | |||
|
|||
export default process.stdout.isTTY && !isCI; | |||
export default process.stdout.isTTY && process.env.TERM !== 'dumb' && !isCI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like there should exist some module which has this logic already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same feeling, but I couldn't find one that specifically checks for a dumb terminal without doing other stuff. For example supports-color takes into account if a terminal is dumb but it's coupled with color related features that we don't want to check in this case.
Thanks for submitting a well detailed issues and PR to Jest to fix an issue you were running into! |
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. |
Summary
Fixes #5236 and related issues outside of Emacs. Essentially, the issue is that
isInteractive
only checksprocess.stdin.isTTY
and CI environment variables, but it should treat a shell withTERM
set todumb
as noninteractive even if is has a TTY (not all TTYs support interactive escape codes). Note that while Emacs' Compilation mode supports interactive comint processes with a prefix argument, it is still not supported with this Jest patch (for examplejest --watch
will ignore input).Test plan
yarn test packages/jest-util/src/__tests__/is_interactive.test.js
passesyarn link
andjest
in another project in Emacs successfully hides mode escape codes (though is an extra�[999D
right after the lastPASS
line that I can't figure out how to remove, I'd appreciate feedback)