(client: TestDatabaseClient)
| 59 | } |
| 60 | |
| 61 | export async function closeTestDatabaseClient(client: TestDatabaseClient): Promise<void> { |
| 62 | await enqueueTestDatabaseOperation(async () => { |
| 63 | const clients = (globalThis as TestDatabaseGlobal)[TEST_DATABASE_CLIENTS_KEY]; |
| 64 | if (!clients?.delete(client)) { |
| 65 | client.close(); |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | try { |
| 70 | // libsql requires a process-wide shared in-memory cache for its internal |
| 71 | // connections. Reset it only after the final module graph has stopped using it. |
| 72 | if (clients.size === 0) { |
| 73 | await resetTestDatabaseClient(client); |
| 74 | } |
| 75 | } finally { |
| 76 | client.close(); |
| 77 | } |
| 78 | }); |
| 79 | } |
| 80 | |
| 81 | export async function closeTestDatabaseClients(): Promise<void> { |
| 82 | await enqueueTestDatabaseOperation(async () => { |
no test coverage detected
searching dependent graphs…