title: Sinon unit test pass as expected but coverage report shows it is not covered
body: <p>Given a class and method such as:</p>
  <pre><code>export default class Router {
      constructor(private request: Request) {
          this.request = request;
  }
  
  public async handle(): Promise&lt;string | undefined&gt; {
      const pathname = new URL(this.request.url).pathname;
  
      if (pathname !== &quot;/requests&quot; &amp;&amp; pathname !== &quot;/shipments&quot;) {
        throw new ValidatorError(
           &quot;ERR_HTTP_PATH&quot;,
           &quot;Not Found&quot;,
           404,
      );
  
      ...
  }
  </code></pre>
  <p>And a unit test such as:</p>
  <pre><code>Deno.test(&quot;router should throw when endpoint is not /requests nor /shipments&quot;, async () =&gt; {
    const fakeError = {
      message: &quot;ERR_HTTP_PATH&quot;,
      cause: &quot;Not Found&quot;,
      status: 404,
    };
  
    const stub = sinon.stub(Router.prototype, &quot;handle&quot;);
    stub.rejects(fakeError);
  
    const fakeRequest = new Request(&quot;http://fakerequest:5000/fakerequest&quot;);
  
    const path = new URL(fakeRequest.url).pathname;
  
    asserts.assertNotEquals(path, &quot;/requests&quot;);
    asserts.assertNotEquals(path, &quot;/shipments&quot;);
  
    await new Router(fakeRequest)
      .handle()
      .catch(err =&gt; asserts.assertEquals(err, fakeError))
      .finally(() =&gt; {
        asserts.assert(stub.called);
        stub.restore();
      });
  });
  </code></pre>
  <p>This test pass. But why the test coverage reports it as not covered?</p>
  <pre><code>12 if (pathname !== &quot;/requests&quot; &amp;&amp; pathname !== &quot;/shipments&quot;) {
    13 |       throw new ValidatorError(
    14 |         &quot;ERR_HTTP_PATH&quot;,
    15 |         &quot;Not Found&quot;,
    16 |         404,
    17 |       );
    18 |     }
  </code></pre>
  <p>I have checked the coverage is not cached internally and it is not. Docs actually says that --coverage is an accurate representation of the code coverage from the V8 engine.</p>
  <p>What am I doing wrong here?</p>
  <p>Do I have to necessarily stub out the <code>ValidatorError</code> class even though I have stubbed the <code>handle</code> method to throw and replace the class behavior?</p>
  <p>What do I have to do to get this covered in the coverage report?</p>
  <p>Thank you</p>