summaryrefslogtreecommitdiff
path: root/cli/tests/testdata
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2022-11-13 17:35:28 +0900
committerGitHub <noreply@github.com>2022-11-13 17:35:28 +0900
commit336e96a114555994b9e996c705c00d23b735d9d6 (patch)
treeedb23c4d39bad2af2dd13ebc537aea2e315c799d /cli/tests/testdata
parent88643aa4780d1099d81ea5b971278d04dd5d3dd2 (diff)
fix(ext/flash): revert #16383 (graceful server startup/shutdown) (#16610)
#16383 made some of Node compat test cases flaky in deno_std (and when it fails it causes segfaults). See https://github.com/denoland/deno_std/issues/2882 for details
Diffstat (limited to 'cli/tests/testdata')
-rw-r--r--cli/tests/testdata/run/flash_shutdown/main.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/tests/testdata/run/flash_shutdown/main.ts b/cli/tests/testdata/run/flash_shutdown/main.ts
new file mode 100644
index 000000000..7f6985e34
--- /dev/null
+++ b/cli/tests/testdata/run/flash_shutdown/main.ts
@@ -0,0 +1,23 @@
+// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+
+// Deno.serve caused segfault with this example after #16383
+// refs:
+// - https://github.com/denoland/deno/pull/16383
+// - https://github.com/denoland/deno_std/issues/2882
+// - revert https://github.com/denoland/deno/pull/16610
+
+const ctl = new AbortController();
+Deno.serve(() =>
+ new Promise((resolve) => {
+ resolve(new Response(new TextEncoder().encode("ok")));
+ ctl.abort();
+ }), {
+ signal: ctl.signal,
+ async onListen({ port }) {
+ const a = await fetch(`http://localhost:${port}`, {
+ method: "POST",
+ body: "",
+ });
+ await a.text();
+ },
+});