When restarting test server with resetting the database, don't forget to close it (#923)

This commit is contained in:
Dmitry 2024-04-01 16:35:00 -04:00 committed by GitHub
parent 2140900d58
commit 3405ce902e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,6 +67,9 @@ export class TestServerMerged extends EventEmitter implements IMochaServer {
this._starts++; this._starts++;
const workerIdText = process.env.MOCHA_WORKER_ID || '0'; const workerIdText = process.env.MOCHA_WORKER_ID || '0';
if (reset) { if (reset) {
// Make sure this test server doesn't keep using the DB that's about to disappear.
await this.closeDatabase();
if (process.env.TESTDIR) { if (process.env.TESTDIR) {
this.testDir = path.join(process.env.TESTDIR, workerIdText); this.testDir = path.join(process.env.TESTDIR, workerIdText);
} else { } else {