diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/signal_test.ts | 10 | ||||
-rw-r--r-- | tests/unit_node/process_test.ts | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/unit/signal_test.ts b/tests/unit/signal_test.ts index 2ba2ffb15..1d9b10ae7 100644 --- a/tests/unit/signal_test.ts +++ b/tests/unit/signal_test.ts @@ -172,10 +172,20 @@ Deno.test( } // Sends SIGUSR1 (irrelevant signal) 3 times. + // By default SIGUSR1 terminates, so set it to a no-op for this test. + let count = 0; + const irrelevant = () => { + count++; + }; + Deno.addSignalListener("SIGUSR1", irrelevant); for (const _ of Array(3)) { await delay(20); Deno.kill(Deno.pid, "SIGUSR1"); } + while (count < 3) { + await delay(20); + } + Deno.removeSignalListener("SIGUSR1", irrelevant); // No change assertEquals(c, "010101000"); diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index a28e1e5cd..f496290d9 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -237,7 +237,7 @@ Deno.test({ Deno.test({ name: "process.off signal", - ignore: true, // This test fails to terminate + ignore: Deno.build.os == "windows", async fn() { const testTimeout = setTimeout(() => fail("Test timed out"), 10_000); try { @@ -246,13 +246,13 @@ Deno.test({ "eval", ` import process from "node:process"; - console.log("ready"); setInterval(() => {}, 1000); const listener = () => { + process.off("SIGINT", listener); console.log("foo"); - process.off("SIGINT", listener) }; process.on("SIGINT", listener); + console.log("ready"); `, ], stdout: "piped", @@ -275,6 +275,7 @@ Deno.test({ while (!output.includes("foo\n")) { await delay(10); } + process.kill("SIGINT"); await process.status; } finally { clearTimeout(testTimeout); |