(assertion: () => void)
| 171 | } |
| 172 | |
| 173 | async function waitForAssertion(assertion: () => void): Promise<void> { |
| 174 | let lastError: unknown; |
| 175 | for (let attempt = 0; attempt < 20; attempt += 1) { |
| 176 | try { |
| 177 | assertion(); |
| 178 | return; |
| 179 | } catch (error) { |
| 180 | lastError = error; |
| 181 | await new Promise((resolve) => setTimeout(resolve, 0)); |
| 182 | } |
| 183 | } |
| 184 | throw lastError; |
| 185 | } |
| 186 | |
| 187 | describe('runPrompt', () => { |
| 188 | afterEach(() => { |