title: asserting against thrown error objects in jest
body: <p>I have a function which throws an object, how can I assert that the correct object is thrown in jest?</p>
  
  <pre><code>it('should throw', () =&gt; {
  
    const errorObj = {
      myError: {
        name: 'myError',
        desc: 'myDescription'
      }
    };
  
    const fn = () =&gt; {
      throw errorObj;
    }
  
    expect(() =&gt; fn()).toThrowError(errorObj);
  });
  </code></pre>
  
  <p><a href="https://repl.it/repls/FrayedViolentBoa" rel="noreferrer">https://repl.it/repls/FrayedViolentBoa</a></p>