Skip to content

Jest should treat some Emacs buffers as noninteractive #5236

@nickserv

Description

@nickserv

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions