()
| 2384 | // ===== Force Cleanup for Test Files ===== |
| 2385 | |
| 2386 | export async function forceCleanup(): Promise<void> { |
| 2387 | // Clean up existing Foam instance |
| 2388 | TestFoam.dispose(); |
| 2389 | |
| 2390 | // Clear all event listeners by resetting emitters |
| 2391 | mockState.activeTextEditor = undefined; |
| 2392 | mockState.visibleTextEditors = []; |
| 2393 | |
| 2394 | // Close any open file handles by clearing the file system |
| 2395 | mockState.fileSystem = new MockFileSystem(); |
| 2396 | |
| 2397 | // Clear configuration |
| 2398 | mockState.configuration = new MockWorkspaceConfiguration(); |
| 2399 | |
| 2400 | // Force garbage collection |
| 2401 | if (global.gc) { |
| 2402 | global.gc(); |
| 2403 | } |
| 2404 | |
| 2405 | // Wait for any pending file system operations to complete |
| 2406 | await new Promise(resolve => setTimeout(resolve, 10)); |
| 2407 | } |
no test coverage detected