fix(): Module test runner lifecycle does not shutdown properly (#13628)
* fix(): Module test runner lifecycle does not shutdown properly * Create late-feet-think.md
This commit is contained in:
committed by
GitHub
parent
9c7c1d48c7
commit
70d855bd1b
5
.changeset/late-feet-think.md
Normal file
5
.changeset/late-feet-think.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/test-utils": patch
|
||||
---
|
||||
|
||||
fix(): Module test runner lifecycle does not shutdown properly
|
||||
@@ -63,14 +63,13 @@ export async function initModules({
|
||||
await medusaApp.onApplicationStart()
|
||||
|
||||
async function shutdown() {
|
||||
if (shouldDestroyConnectionAutomatically) {
|
||||
await medusaApp.onApplicationPrepareShutdown()
|
||||
const promises: Promise<void>[] = []
|
||||
promises.push(medusaApp.onApplicationPrepareShutdown())
|
||||
promises.push(medusaApp.onApplicationShutdown())
|
||||
|
||||
await promiseAll([
|
||||
(sharedPgConnection as any).context?.destroy(),
|
||||
(sharedPgConnection as any).destroy(),
|
||||
medusaApp.onApplicationShutdown(),
|
||||
])
|
||||
if (shouldDestroyConnectionAutomatically) {
|
||||
promises.push((sharedPgConnection as any).context?.destroy())
|
||||
promises.push((sharedPgConnection as any).destroy())
|
||||
} else {
|
||||
if (!preventConnectionDestroyWarning) {
|
||||
logger.info(
|
||||
@@ -78,6 +77,8 @@ export async function initModules({
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
await promiseAll(promises)
|
||||
moduleSdkImports.MedusaModule.clearInstances()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user