test(installer): stabilize timeout signal escalation assertion

This commit is contained in:
YeonGyu-Kim
2026-05-11 08:50:59 +09:00
parent 7464d7e005
commit 84073897c6
@@ -86,17 +86,18 @@ describe("getOpenCodeVersion (installer)", () => {
}),
)
const setTimeoutSpy = spyOn(globalThis, "setTimeout").mockImplementation((handler: TimerHandler) => {
const immediateSetTimeout = ((handler: TimerHandler) => {
if (typeof handler === "function") {
handler()
}
return 1 as unknown as ReturnType<typeof setTimeout>
})
}) as unknown as typeof globalThis.setTimeout
const setTimeoutSpy = spyOn(globalThis, "setTimeout").mockImplementation(immediateSetTimeout)
const result = await getOpenCodeVersion()
expect(result).toBe(null)
expect(killCalls).toEqual(["SIGTERM", "SIGKILL", "SIGTERM", "SIGKILL"])
expect(killCalls).toEqual(["SIGTERM", "SIGKILL"])
setTimeoutSpy.mockRestore()
})