question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The cli doesn't exit correctly when stdout is a non-tty

See original GitHub issue

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

Bug

What is the current behavior?

If you are redirecting stdout to a file (or have stdout not connected to a tty in a similar way), then the jest-cli process will exit with 0 even if there are failing tests. If you execute jest from the cli without any kind of redirect in place, then you get a non-zero exit value for failing tests as expected.

It appears that this was introduced with the exit changes in this PR https://github.com/facebook/jest/pull/5313

What is the expected behavior?

A non-zero exit value in the case of test failures.

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

  • node v6.11.4
  • npm v3.10.10
  • jest 22.1.1
  • ubuntu 14.04

NOTE I updated the description since the original bug report with my latest findings

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:36 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
lsjrobertscommented, Jan 24, 2018

I can confirm we are experiencing the same issue, all great locally but on Jenkins a failed test run exits with 0. Pinning both jest and jest-cli to 22.1.0 fixes it.

2reactions
Fantaztigcommented, Jan 13, 2020

Same issue with jenkins and jest 24.9.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash + Node.js + stdin/stdout redirection: error "not a tty"
As far as I did understand, on Git Windows node command for e.g. node file_name.js invokes itself through aliased winpty resulting in side ......
Read more >
What does an `output is not a tty` error mean? - Super User
In the directory you are running the command, is there a file or directory called "info" already ? – gerhard d. Dec 10,...
Read more >
How to tell if output of a command or shell script is stdout or ...
There's no way to tell once the output has already been printed. ... that command is executed correctly (stdout), here you can find...
Read more >
docker attach - Docker Documentation
Get the exit code of the container's command . And in this second example, you can see the exit code returned by...
Read more >
runners - Invoke documentation
The return value is None instead of a Result or subclass. No I/O worker threads are spun up, so you will have no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found