How to test type of thrown exception in Jest : <p>I'm working with some code where I need to test type of exception thrown by function (Is it TypeError, ReferenceError etc.).</p>

<p>My current testing framework is AVA and I can test it as a second argument <code>t.throws</code> method, like here:</p>

<pre class="lang-js prettyprint-override"><code>it('should throw Error with message \'UNKNOWN ERROR\' when no params were passed', (t) =&gt; {
  const error = t.throws(() =&gt; {
    throwError();
  }, TypeError);

  t.is(error.message, 'UNKNOWN ERROR');
});
</code></pre>

<p>I started rewriting my tests to Jest and couldn't find how to easily do that. Is it even possible?</p>
