diff options
| author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-24 10:27:29 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-24 00:27:29 +0100 |
| commit | 947ce41e99637dae4cf46126b8bb2d4107fb9913 (patch) | |
| tree | 094cdca89b38d358bb801702b4caf5dcb6374c80 /cli/tests/unit/http_test.ts | |
| parent | 4eedac3604dad9f366d28868077eb02eddc22661 (diff) | |
feat: deprecate `Deno.resources()` (#22059)
Most uses of `Deno.resources()` within tests, as they previously checked
for leaked resources. This is not needed as the test runner does this
automatically. Other internal uses of this API have been replaced with
the internal `Deno[Deno.internal].core.resources()`.
Diffstat (limited to 'cli/tests/unit/http_test.ts')
| -rw-r--r-- | cli/tests/unit/http_test.ts | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts index acdaef903..a7f34f0ac 100644 --- a/cli/tests/unit/http_test.ts +++ b/cli/tests/unit/http_test.ts @@ -1084,6 +1084,9 @@ Deno.test( ); // https://github.com/denoland/deno/issues/11926 +// verify that the only new resource is "httpConnection", to make +// sure "request" resource is closed even if its body was not read +// by server handler Deno.test( { permissions: { net: true } }, async function httpServerDoesntLeakResources2() { @@ -1105,22 +1108,11 @@ Deno.test( } })(); - const resourcesBefore = Deno.resources(); const response = await fetch(`http://127.0.0.1:${listenPort}`, { method: "POST", body: "hello world", }); await response.text(); - const resourcesAfter = Deno.resources(); - // verify that the only new resource is "httpConnection", to make - // sure "request" resource is closed even if its body was not read - // by server handler - - for (const rid of Object.keys(resourcesBefore)) { - delete resourcesAfter[Number(rid)]; - } - - assertEquals(Object.keys(resourcesAfter).length, 1); listener!.close(); httpConn!.close(); |
