summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/flash_test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts
index 07be6dfcc..fef45beb9 100644
--- a/cli/tests/unit/flash_test.ts
+++ b/cli/tests/unit/flash_test.ts
@@ -57,6 +57,35 @@ Deno.test(async function httpServerCanResolveHostnames() {
await server;
});
+Deno.test(async function httpServerRejectsOnAddrInUse() {
+ const ac = new AbortController();
+ const listeningPromise = deferred();
+
+ const server = Deno.serve({
+ handler: (_req) => new Response("ok"),
+ hostname: "localhost",
+ port: 4501,
+ signal: ac.signal,
+ onListen: onListen(listeningPromise),
+ onError: createOnErrorCb(ac),
+ });
+
+ assertRejects(
+ () =>
+ Deno.serve({
+ handler: (_req) => new Response("ok"),
+ hostname: "localhost",
+ port: 4501,
+ signal: ac.signal,
+ onListen: onListen(listeningPromise),
+ onError: createOnErrorCb(ac),
+ }),
+ Deno.errors.AddrInUse,
+ );
+ ac.abort();
+ await server;
+});
+
Deno.test({ permissions: { net: true } }, async function httpServerBasic() {
const ac = new AbortController();
const promise = deferred();