title: Running jest tests from shell script - have failures cause script to exit
body: <p>I have a plain package.json that runs <a href="http://facebook.github.io/jest/docs/getting-started.html" rel="noreferrer">jest</a> tests with <code>npm test</code> command. The relevant parts of the package.json look like so:</p>
  
  <pre><code>{
    "scripts": {
       "test": "jest",
     "jest": {
      "scriptPreprocessor": "../shared/preprocessor.js"
    }
  }
  </code></pre>
  
  <p>The shell script looks like so:</p>
  
  <pre><code>script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &amp;&amp; pwd)"
  parent_dir="$script_dir/.."
  
  echo
  echo "Running all tests..."
  find "$parent_dir" -name package.json -maxdepth 2 -execdir npm test \;
  </code></pre>
  
  <p>Right now when a jest test fails, the bash script does not exit with a failure status. I would like it do so for the purposes of creating a CI loop with Jenkins. An example of a jest test failure is as follows:</p>
  
  <pre><code> FAIL  js/components/__tests__/ExperienceCampaign-tests.js (13.19s)
  ● ExperienceCampaign › listening to ExperienceCampaignStore › it starts listening when the component is mounted
    - Expected: true toBe: false
          at Spec.&lt;anonymous&gt; (/Users/jonathan/experience-studio/campaign/js/components/__tests__/ExperienceCampaign-tests.js:54:26)
          at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
  1 test failed, 0 tests passed (1 total)
  Run time: 13.748s
  npm ERR! Test failed.  See above for more details.
  npm ERR! not ok code 0 
  </code></pre>
  
  <p>Any help is appreciated.</p>