Chore/integration tests modules utils (#6581)

new wrapper for medusa integration tests.
for now it is only applied to the modules directory, but it could be used in the api integration tests or any other integrations that requires a db and a server up and running. 

It is not perfect, but I wanted to have something working and centralised before improving it, also avoiding too many conflicts with other prs
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-03-06 10:03:07 +00:00
1 parent a6736c7ee0
commit 51bb6f1e89
99 files changed
+10164 -10303

No files matched your search

+1 -1
View File
@@ -337,7 +337,7 @@ async function MedusaApp_({
)
}
const linkModuleOpt = { ...linkModuleOptions }
const linkModuleOpt = { ...(linkModuleOptions ?? {}) }
linkModuleOpt.database ??= {
...(sharedResourcesConfig?.database ?? {}),
}
+9 -3
View File
@@ -285,11 +285,14 @@ export class MedusaModule {
moduleDefinition
)
const logger_ =
container.resolve("logger", { allowUnregistered: true }) ?? logger
try {
await moduleLoader({
container,
moduleResolutions,
logger,
logger: logger_,
migrationOnly,
})
} catch (err) {
@@ -314,7 +317,7 @@ export class MedusaModule {
].__joinerConfig()
if (!joinerConfig.primaryKeys) {
logger.warn(
logger_.warn(
`Primary keys are not defined by the module ${keyName}. Setting default primary key to 'id'${EOL}`
)
@@ -407,11 +410,14 @@ export class MedusaModule {
moduleExports
)
const logger_ =
container.resolve("logger", { allowUnregistered: true }) ?? logger
try {
await moduleLoader({
container,
moduleResolutions,
logger,
logger: logger_,
})
} catch (err) {
errorLoading(err)