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:
@@ -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()
|
await medusaApp.onApplicationStart()
|
||||||
|
|
||||||
async function shutdown() {
|
async function shutdown() {
|
||||||
if (shouldDestroyConnectionAutomatically) {
|
const promises: Promise<void>[] = []
|
||||||
await medusaApp.onApplicationPrepareShutdown()
|
promises.push(medusaApp.onApplicationPrepareShutdown())
|
||||||
|
promises.push(medusaApp.onApplicationShutdown())
|
||||||
|
|
||||||
await promiseAll([
|
if (shouldDestroyConnectionAutomatically) {
|
||||||
(sharedPgConnection as any).context?.destroy(),
|
promises.push((sharedPgConnection as any).context?.destroy())
|
||||||
(sharedPgConnection as any).destroy(),
|
promises.push((sharedPgConnection as any).destroy())
|
||||||
medusaApp.onApplicationShutdown(),
|
|
||||||
])
|
|
||||||
} else {
|
} else {
|
||||||
if (!preventConnectionDestroyWarning) {
|
if (!preventConnectionDestroyWarning) {
|
||||||
logger.info(
|
logger.info(
|
||||||
@@ -78,6 +77,8 @@ export async function initModules({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await promiseAll(promises)
|
||||||
moduleSdkImports.MedusaModule.clearInstances()
|
moduleSdkImports.MedusaModule.clearInstances()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user