diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index fe463fea36..5753538eb7 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -137,21 +137,28 @@ class TestConfiguration { return this.createApp(appName) } - end() { + async end() { if (!this) { return } - if (this.server) { - this.server.close() - } if (this.allApps) { cleanup(this.allApps.map(app => app.appId)) + + await this._req( + null, + { appId: this.prodApp.appId }, + controllers.app.destroy + ) + } + + if (this.server) { + this.server.close() } } // UTILS - async _req(body: any, params: any, controlFunc: any) { + _req(body: any, params: any, controlFunc: any) { // create a fake request ctx const request: any = {} const appId = this.appId