summaryrefslogtreecommitdiff
path: root/cli/tests/unit/serve_test.ts
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-05-08 09:52:56 +0200
committerGitHub <noreply@github.com>2023-05-08 09:52:56 +0200
commit687a9395889c2653449c0453e35a12b889c56519 (patch)
treee25dcc0525f84332807c007fc175e61283256cd9 /cli/tests/unit/serve_test.ts
parent40987178c4f9baf54599b502f943be76f42d6f85 (diff)
fix(ext/http): Ensure Deno.serve works across --watch restarts (#18998)
Fixes #16699 and #18960 by ensuring that we release our HTTP `spawn_local` tasks when the HTTP resource is dropped. Because our cancel handle was being projected from the resource via `RcMap`, the resource was never `Drop`ped. By splitting the handle out into its own `Rc`, we can avoid keeping the resource alive and let it drop to cancel everything.
Diffstat (limited to 'cli/tests/unit/serve_test.ts')
-rw-r--r--cli/tests/unit/serve_test.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/tests/unit/serve_test.ts b/cli/tests/unit/serve_test.ts
index 5d5d0428f..ce7267f58 100644
--- a/cli/tests/unit/serve_test.ts
+++ b/cli/tests/unit/serve_test.ts
@@ -94,8 +94,9 @@ Deno.test(async function httpServerRejectsOnAddrInUse() {
onListen: onListen(listeningPromise),
onError: createOnErrorCb(ac),
});
+ await listeningPromise;
- assertRejects(
+ await assertRejects(
() =>
Deno.serve({
handler: (_req) => new Response("ok"),