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

Jest should treat some Emacs buffers as noninteractive #5236

Closed
nickserv opened this issue Jan 5, 2018 · 3 comments · Fixed by #5237
Closed

Jest should treat some Emacs buffers as noninteractive #5236

nickserv opened this issue Jan 5, 2018 · 3 comments · Fixed by #5237

Comments

@nickserv
Copy link
Contributor

nickserv commented Jan 5, 2018

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
In Emacs, using shell, eshell, shell-command or compile launches a noninteractive buffer that displays the output of the given command. This is a convenient way to run command line tools like Jest in Emacs without having to open a shell. When used with Jest, it incorrectly assumes that the TTY is interactive and prints extra characters that makes the test output long and difficult to read. term and ansi-term do not have this issue because they are full terminal emulators, but many Emacs users do not use them.

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.

  1. Launch Emacs.
  2. Open the directory of any project using Jest.
  3. Run M-x shell-command or M-x compile with your Jest script (probably just npm test or an npx command). Alternatively to get an interactive shell that is not POSIX compliant and should not be marked as interactive by Jest, use M-x shell or M-x eshell.

What is the expected behavior?
require('jest-util').isInteractive should be false in Compilation, Shell Command, Shell, Eshell, and other noninteractive Emacs buffers. Note that Emacs does have other interactive shells. If it's not possible for Jest to determine what kind of Emacs buffer it's running in, Emacs does set some environment variables that tell processes when they are executed in Emacs, and in that case it would be nice to default to disabling interactivity in Emacs.

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

  • Jest 22.0.4
  • Node 9.3.0
  • npm 5.6.0
  • macOS 10.13.2
  • GNU Emacs 25.3 (9.0) [Homebrew Cask]
@cpojer
Copy link
Member

cpojer commented Jan 5, 2018

Would you mind sending a PR to fix this? Thanks!

@nickserv
Copy link
Contributor Author

nickserv commented Jan 5, 2018

I would like to contribute, but to be honest I'm not 100% sure this is possible and I don't know much about the accuracy of process.std.isTTY or ANSI escape codes. I would appreciate any advice, though I realize this is a fairly specific issue.

Also if it helps, using CI=true temporarily fixes the issue (since it sets isInteractive to false), but I don't want to mark every command I run inside emacs as running in CI.

EDIT:
I did a little experimenting, and fortunately Emacs properly sets TERM to dumb in noninteractive buffers. Would it be safe to rely on this value or are there cases where a dumb terminal in another application should be interactive?

@github-actions
Copy link

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.

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

Successfully merging a pull request may close this issue.

2 participants