diff options
Diffstat (limited to 'test/js/node/process/process.test.js')
-rw-r--r-- | test/js/node/process/process.test.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/js/node/process/process.test.js b/test/js/node/process/process.test.js index 51825b2b4..890f5032e 100644 --- a/test/js/node/process/process.test.js +++ b/test/js/node/process/process.test.js @@ -401,6 +401,33 @@ describe("signal", () => { expect(await child.exited).toBe(0); expect(await new Response(child.stdout).text()).toBe("PASS\n"); }); + + it("process.kill(2) works", async () => { + const child = Bun.spawn({ + cmd: ["bash", "-c", "sleep 1000000"], + stdout: "pipe", + }); + const prom = child.exited; + process.kill(child.pid, "SIGTERM"); + await prom; + expect(child.signalCode).toBe("SIGTERM"); + }); + + it("process._kill(2) works", async () => { + const child = Bun.spawn({ + cmd: ["bash", "-c", "sleep 1000000"], + stdout: "pipe", + }); + const prom = child.exited; + process.kill(child.pid, 9); + await prom; + expect(child.signalCode).toBe("SIGKILL"); + }); + + it("process.kill(2) throws on invalid input", async () => { + expect(() => process.kill(0, "SIGPOOP")).toThrow(); + expect(() => process.kill(0, 456)).toThrow(); + }); }); const undefinedStubs = [ |