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.

react-scripts test (or Jest) is reporting exit code 0 on test failures

See original GitHub issue

Is this a bug report?

Possibly

Did you try recovering your dependencies?

Yes

Environment

System:
    OS: macOS High Sierra 10.13.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
  Browsers:
    Chrome: 75.0.3770.80
    Firefox: 66.0.2
    Safari: 12.1
  npmPackages:
    react: ^16.6.3 => 16.6.3
    react-dom: ^16.6.3 => 16.6.3
    react-scripts: 2.1.8 => 2.1.8
  npmGlobalPackages:
    create-react-app: Not Found

Steps to Reproduce

  1. Create a CRA project with tests
  2. Create a bash script that encapsulates the react-scripts test command execution
  3. Output the exit code result from within that wrapping bash script

Expected Behavior

I expect the exit code to be non-zero when tests fail

Actual Behavior

react-scripts test is reporting a 0 exit code

Reproducible Demo

None yet

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
silverwindcommented, Jun 27, 2019

Imho, a proper exit code should be set by default and not only with obscure arguments like --bail.

0reactions
mAAdhaTTahcommented, Jul 19, 2019

Also --bail will stop running tests on the first error, rather than running the full test suite then erroring.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest RTL tests passing but getting Process finished with ...
My tests are all passing successfully, at least in practise. I ran the tests 20 times and 19 times it passed. Once it...
Read more >
Configuring Jest
This option tells Jest that all imported modules in your tests should be mocked ... or pass the expected return value ... Default:...
Read more >
How To Test a React App with Jest and React Testing Library
In this tutorial, you will test asynchronous code and interactions in a sample project containing various UI elements. You will use Jest to ......
Read more >
Jest Addon | Storybook: Frontend workshop for UI ...
React storybook addon that show component jest report. ... need to consider that if your tests fail, the script receives a non-0 exit...
Read more >
Testing Recipes
This page assumes you're using Jest as a test runner. ... "react"; export default function Hello(props) { if (props.name) { return <h1>Hello, {props.name}!...
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