From 947ce41e99637dae4cf46126b8bb2d4107fb9913 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 24 Jan 2024 10:27:29 +1100 Subject: 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()`. --- cli/tests/unit/http_test.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'cli/tests/unit/http_test.ts') 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(); -- cgit v1.2.3