summaryrefslogtreecommitdiff
path: root/cli/tests/unit/flash_test.ts
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2022-11-27 04:50:14 +0100
committerGitHub <noreply@github.com>2022-11-27 04:50:14 +0100
commit0012484f4f194664bea87879ab9f4f20f4ee86c6 (patch)
tree29feb95f1f41cc68bce5b3cfedb4e04d7c186cb6 /cli/tests/unit/flash_test.ts
parent95fb4b886b6f8cb0c3805cd77b6c1359e967bd60 (diff)
Revert "fix(ext/flash): graceful server startup/shutdown with unsettl… (#16839)
…ed promises in mind (#16616)" This reverts commit fd023cf7937e67dfde5482d34ebc60839eb7397c. There are reports saying that Vite is often hanging in 1.28.2 and this is the only PR that changed something with HTTP server. I think we should hold off on trying to fix this and instead focus on #16787 CC @magurotuna
Diffstat (limited to 'cli/tests/unit/flash_test.ts')
-rw-r--r--cli/tests/unit/flash_test.ts32
1 files changed, 11 insertions, 21 deletions
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts
index 761b9137a..024069455 100644
--- a/cli/tests/unit/flash_test.ts
+++ b/cli/tests/unit/flash_test.ts
@@ -57,42 +57,32 @@ Deno.test(async function httpServerCanResolveHostnames() {
await server;
});
-// TODO(magurotuna): ignore this case for now because it's flaky on GitHub Actions,
-// although it acts as expected when running locally.
-// See https://github.com/denoland/deno/pull/16616
-Deno.test({ ignore: true }, async function httpServerRejectsOnAddrInUse() {
- const ac1 = new AbortController();
+Deno.test(async function httpServerRejectsOnAddrInUse() {
+ const ac = new AbortController();
const listeningPromise = deferred();
- let port: number;
const server = Deno.serve({
handler: (_req) => new Response("ok"),
hostname: "localhost",
- port: 0,
- signal: ac1.signal,
- onListen: (addr) => {
- port = addr.port;
- listeningPromise.resolve();
- },
- onError: createOnErrorCb(ac1),
+ port: 4501,
+ signal: ac.signal,
+ onListen: onListen(listeningPromise),
+ onError: createOnErrorCb(ac),
});
- await listeningPromise;
-
- const ac2 = new AbortController();
assertRejects(
() =>
Deno.serve({
handler: (_req) => new Response("ok"),
hostname: "localhost",
- port,
- signal: ac2.signal,
+ port: 4501,
+ signal: ac.signal,
+ onListen: onListen(listeningPromise),
+ onError: createOnErrorCb(ac),
}),
Deno.errors.AddrInUse,
);
-
- ac1.abort();
- ac2.abort();
+ ac.abort();
await server;
});