title: Test case is leaking async ops on deno
body: <p>I downloaded the example app from Drash (<a href="https://github.com/drashland/deno-drash" rel="noreferrer">https://github.com/drashland/deno-drash</a>)</p>
  <p><code>$ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --api</code></p>
  <p>and try to add a new test, which:</p>
  <ol>
  <li>will fetch GET /</li>
  <li>Assert status code and response json</li>
  </ol>
  <pre class="lang-js prettyprint-override"><code>Deno.test(&quot;HomeResource - GET /&quot;, async () =&gt; {
    const response = await fetch(&quot;http://localhost:1557&quot;, {
      method: &quot;GET&quot;,
    });
    assertEquals(response.status, 200);
    assertEquals(
      await response.json(),
      JSON.stringify({
        success: true,
        message: &quot;GET request received.&quot;,
      }),
    );
  });
  </code></pre>
  <p>Here is the error message</p>
  <pre><code>Server listening: http://localhost:1557
  running 5 tests
  test HomeResource - GET / ... FAILED (9ms)
  test HomeResource - POST / ... ok (2ms)
  test HomeResource - PUT / ... ok (2ms)
  test HomeResource - DELETE / ... ok (2ms)
  
  Stop the server ... ok (0ms)
  
  failures:
  
  HomeResource - GET /
  AssertionError: Test case is leaking async ops.
  Before:
    - dispatched: 1
    - completed: 0
  After:
    - dispatched: 9
    - completed: 7
  
  Make sure to await all promises returned from Deno APIs before
  finishing test case.
      at assert (rt/06_util.js:33:13)
      at asyncOpSanitizer (rt/40_testing.js:44:7)
      at async Object.resourceSanitizer [as fn] (rt/40_testing.js:68:7)
      at async TestRunner.[Symbol.asyncIterator] (rt/40_testing.js:240:13)
      at async Object.runTests (rt/40_testing.js:317:22)
  
  failures:
  
      HomeResource - GET /
  
  test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (15ms)
  
  </code></pre>
  <p>I have tried to cancel the body with
  <code>response.body?.cancel()</code>, but says that the stream is locked.</p>
  <p>Tests: <a href="https://github.com/ramonmedeiros/learning_deno/blob/master/tests/resources/home_resource_test.ts" rel="noreferrer">https://github.com/ramonmedeiros/learning_deno/blob/master/tests/resources/home_resource_test.ts</a></p>