( pid: number = 123, killed: boolean = false, )
| 18 | |
| 19 | // Mock ChildProcess |
| 20 | const createMockProcess = ( |
| 21 | pid: number = 123, |
| 22 | killed: boolean = false, |
| 23 | ): jest.Mocked<ChildProcess> => { |
| 24 | const mockProcess = { |
| 25 | pid, |
| 26 | killed, |
| 27 | kill: jest.fn(), |
| 28 | } as unknown as jest.Mocked<ChildProcess>; |
| 29 | |
| 30 | // Make kill() update the killed property |
| 31 | mockProcess.kill.mockImplementation(() => { |
| 32 | (mockProcess as any).killed = true; |
| 33 | return true; |
| 34 | }); |
| 35 | |
| 36 | return mockProcess; |
| 37 | }; |
| 38 | |
| 39 | describe("processTerminalStates", () => { |
| 40 | beforeEach(() => { |
no outgoing calls
no test coverage detected