title: Jest spyOn call count after mock implementation throwing an error
body: <p>I have a program that makes three <code>post</code> requests in this order</p>
  <ol>
  <li>http://myservice/login</li>
  <li>http://myservice/upload</li>
  <li>http://myservice/logout</li>
  </ol>
  <p>The code looks something like this</p>
  <pre><code>async main() {
      try {
          await this.login()
          await this.upload()
      } catch (e) {
          throw e
      } finally {
          await this.logout()
      }
    }
  </code></pre>
  <p>where each method throws its own error on failure.</p>
  <p>I'm using Jest to spy on the underlying request library (superagent). For one particular test I want to test that the logout <code>post</code> request is being made if the upload function throws an error.</p>
  <p>I'm mocking the <code>post</code> request by throwing an exception.</p>
  <pre><code>const superagentStub = {
      post: () =&gt; superagentStub
  }
  
  const postSpy = jest.spyOn(superagent, 'post')
    .mockImplementationOnce(() =&gt; superagentStub)
    .mockImplementationOnce(() =&gt; { throw new Error() })
    .mockImplementationOnce(() =&gt; superagentStub)
  
  const instance = new ExampleProgram();
  
  expect(async () =&gt; await instance.main()).rejects.toThrow(); // This is fine
  expect(postSpy).toHaveBeenNthCalledWith(3, 'http://myservice/logout')
  </code></pre>
  <p>If I don't mock the third implementation, the test will fail as <code>logout()</code> will throw its own <code>error</code> since the third <code>post</code> request will fail as a live call.</p>
  <p>The spy in this case reports that only 1 call is made to the <code>post</code> method of the underlying library.</p>
  <ol>
  <li>http://myservice/login</li>
  </ol>
  <p>I find this strange because I am expecting 3 calls to the spy</p>
  <ol>
  <li>http://myservice/login</li>
  <li>http://myservice/upload  -&gt; but it throws an error</li>
  <li>http://myservice/logout</li>
  </ol>