|
1 | 1 | import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; |
| 2 | +import type { MockInstance } from 'vitest'; |
2 | 3 |
|
3 | 4 | // ── Module mocks ────────────────────────────────────────────────────────────── |
4 | 5 |
|
@@ -116,17 +117,17 @@ function setupHappyPath() { |
116 | 117 | } |
117 | 118 |
|
118 | 119 | describe('runCommit', () => { |
119 | | - let processExitSpy: ReturnType<typeof vi.spyOn>; |
120 | | - let stderrSpy: ReturnType<typeof vi.spyOn>; |
121 | | - let stdoutSpy: ReturnType<typeof vi.spyOn>; |
| 120 | + let processExitSpy: MockInstance<[code?: string | number | null | undefined], never>; |
| 121 | + let stderrSpy: MockInstance<[str: string | Uint8Array, encoding?: BufferEncoding, cb?: (err?: Error | null) => void], boolean>; |
| 122 | + let stdoutSpy: MockInstance<[str: string | Uint8Array, encoding?: BufferEncoding, cb?: (err?: Error | null) => void], boolean>; |
122 | 123 |
|
123 | 124 | beforeEach(() => { |
124 | 125 | vi.clearAllMocks(); |
125 | | - processExitSpy = vi.spyOn(process, 'exit').mockImplementation((() => { |
| 126 | + processExitSpy = vi.spyOn(process, 'exit').mockImplementation((_code?: string | number | null) => { |
126 | 127 | throw new Error('process.exit called'); |
127 | | - }) as (code?: number) => never); |
128 | | - stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true); |
129 | | - stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true); |
| 128 | + }); |
| 129 | + stderrSpy = vi.spyOn(process.stderr, 'write').mockImplementation(() => true) as typeof stderrSpy; |
| 130 | + stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true) as typeof stdoutSpy; |
130 | 131 | }); |
131 | 132 |
|
132 | 133 | afterEach(() => { |
|
0 commit comments