diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2024-09-19 12:22:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 12:22:01 +0900 |
commit | f460188e583f00144000aa0d8ade08218d47c3c1 (patch) | |
tree | 9e297db5e591f7234cc833bb0a43bdeb0c4ce18d /tests/unit_node | |
parent | 282c4c262d3a19fe3ae3fd9ea75811b816e65dc1 (diff) |
fix(ext/node): don't throw error for unsupported signal binding on windows (#25699)
Diffstat (limited to 'tests/unit_node')
-rw-r--r-- | tests/unit_node/process_test.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index 944686a87..add9e1280 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -25,6 +25,7 @@ import { assertThrows, fail, } from "@std/assert"; +import { assertSpyCall, assertSpyCalls, spy } from "@std/testing/mock"; import { stripAnsiCode } from "@std/fmt/colors"; import * as path from "@std/path"; import { delay } from "@std/async/delay"; @@ -238,6 +239,33 @@ Deno.test({ }, }); +Deno.test({ + name: "process.on - ignored signals on windows", + ignore: Deno.build.os !== "windows", + fn() { + const ignoredSignals = ["SIGHUP", "SIGUSR1", "SIGUSR2"]; + + for (const signal of ignoredSignals) { + using consoleSpy = spy(console, "warn"); + const handler = () => {}; + process.on(signal, handler); + process.off(signal, handler); + assertSpyCall(consoleSpy, 0, { + args: [`Ignoring signal "${signal}" on Windows`], + }); + } + + { + using consoleSpy = spy(console, "warn"); + const handler = () => {}; + process.on("SIGTERM", handler); + process.off("SIGTERM", handler); + // No warning is made for SIGTERM + assertSpyCalls(consoleSpy, 0); + } + }, +}); + Deno.test( { permissions: { run: true, read: true } }, async function processKill() { |