summaryrefslogtreecommitdiff
path: root/cli/tests/unit/signal_test.ts
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2021-06-22 15:17:44 +0900
committerGitHub <noreply@github.com>2021-06-22 15:17:44 +0900
commit4e3ec478573ede7247fd306cad1ea5bf2d5c9565 (patch)
treeb78cd4de810d68052f85ae933c4e125d3a4a21ba /cli/tests/unit/signal_test.ts
parent097c02f11bb5fd43e4346fce03b4bacaed119ed2 (diff)
fix(runtime): fix signal promise API (#11069)
Diffstat (limited to 'cli/tests/unit/signal_test.ts')
-rw-r--r--cli/tests/unit/signal_test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/unit/signal_test.ts b/cli/tests/unit/signal_test.ts
index 801e15d8b..e0e94b49a 100644
--- a/cli/tests/unit/signal_test.ts
+++ b/cli/tests/unit/signal_test.ts
@@ -154,6 +154,35 @@ unitTest(
},
);
+// https://github.com/denoland/deno/issues/9806
+unitTest(
+ { ignore: Deno.build.os === "windows", perms: { run: true } },
+ async function signalPromiseTest2(): Promise<void> {
+ const resolvable = deferred();
+ // This prevents the program from exiting.
+ const t = setInterval(() => {}, 1000);
+
+ let called = false;
+ const sig = Deno.signal(Deno.Signal.SIGUSR1);
+ sig.then(() => {
+ called = true;
+ });
+ setTimeout(() => {
+ sig.dispose();
+ setTimeout(() => {
+ resolvable.resolve();
+ }, 10);
+ }, 10);
+
+ clearInterval(t);
+ await resolvable;
+
+ // Promise callback is not called because it didn't get
+ // the corresponding signal.
+ assert(!called);
+ },
+);
+
unitTest(
{ ignore: Deno.build.os === "windows", perms: { run: true } },
function signalShorthandsTest(): void {