* Remove `dir` once nothing holds it. Even after the killed server's 'close', * Windows can keep the dir itself busy a moment longer under load, and * `fs.rmSync`'s `maxRetries` never retries EBUSY on a directory: it throws at * once. A dir still held at the deadline fails the test.
(dir: string, timeoutMs = 5000)
| 122 | * once. A dir still held at the deadline fails the test. |
| 123 | */ |
| 124 | async function removeWhenReleased(dir: string, timeoutMs = 5000): Promise<void> { |
| 125 | const deadline = Date.now() + timeoutMs; |
| 126 | for (;;) { |
| 127 | try { |
| 128 | fs.rmSync(dir, { recursive: true, force: true }); |
| 129 | return; |
| 130 | } catch (error) { |
| 131 | const code = (error as NodeJS.ErrnoException).code ?? ''; |
| 132 | if (!['EBUSY', 'ENOTEMPTY', 'EPERM'].includes(code) || Date.now() > deadline) throw error; |
| 133 | await new Promise((resolve) => setTimeout(resolve, 50)); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | describe('MCP server title and icon', () => { |
| 139 | it('names the server and carries an icon no host has to fetch', () => { |
no outgoing calls
no test coverage detected