title: What is the meaning of UnhandledPromiseRejectionWarning in jest tests?
body: <p>ant to test the following module <code>index.ts</code></p>
  
  <pre><code>async function theFunctionFail() {
    return await fail();
  }
  
  async function theFunctionSucceed() {
    return await succeed();
  }
  
  async function fail() {
    throw new Error();
  }
  
  async function succeed() {
    return "a";
  }
  
  export { theFunctionFail, theFunctionSucceed };
  </code></pre>
  
  <p>using a test <code>index.test.ts</code></p>
  
  <pre><code>import { theFunctionFail, theFunctionSucceed } from "../index";
  
  it('theFunctionFail', () =&gt; {
    expect(theFunctionFail()).rejects;
  });
  </code></pre>
  
  <p>What does the <code>UnhandledPromiseRejectionWarning</code> in the output</p>
  
  <pre><code>(node:10515) UnhandledPromiseRejectionWarning: Error
  (node:10515) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
  (node:10515) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
   PASS  src/__tests__/index.test.ts
    ✓ theFunctionFail (6ms)
  
  Test Suites: 1 passed, 1 total
  Tests:       1 passed, 1 total
  Snapshots:   0 total
  Time:        1.806s
  Ran all test suites.
  </code></pre>
  
  <p>refer to? Wrapping <code>expect(theFunctionFail()).rejects</code> in a <code>try-catch(err)</code> block doesn't avoid the warning which I consider worth fixing.</p>
  
  <p>Why don't the test fail?/How can I make the tests fail? If my test discovered a severe flaw, it shouldn't succeed in my understanding.</p>
  
  <p>I'm using Typescript and Jest 24.7.1 with <code>react-scripts</code>.</p>