diff options
author | Luca Casonato <hello@lcas.dev> | 2023-10-09 12:43:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 12:43:14 +0900 |
commit | ae81065c758a540aa61639e51372c1e254d92c9a (patch) | |
tree | 0012576dc0cce32460c0bbab99d615ea80846c5a /cli/tests/unit/serve_test.ts | |
parent | 35f028daf27bb40e86829e7b7cc19aa72a62c0a0 (diff) |
fix(ext/http): Deno.Server should not be thenable (#20723)
Otherwise you can not return `Deno.Server` from async functions.
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/unit/serve_test.ts')
-rw-r--r-- | cli/tests/unit/serve_test.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/tests/unit/serve_test.ts b/cli/tests/unit/serve_test.ts index 6f58db006..2e560af99 100644 --- a/cli/tests/unit/serve_test.ts +++ b/cli/tests/unit/serve_test.ts @@ -3717,6 +3717,17 @@ async function curlRequestWithStdErr(args: string[]) { return [new TextDecoder().decode(stdout), new TextDecoder().decode(stderr)]; } +Deno.test("Deno.Server is not thenable", async () => { + // deno-lint-ignore require-await + async function serveTest() { + const server = Deno.serve({ port: servePort }, (_) => new Response("")); + assert(!("then" in server)); + return server; + } + const server = await serveTest(); + await server.shutdown(); +}); + Deno.test( { ignore: Deno.build.os === "windows", |