fix(core, medusa-test-utils): Fix medusa test runner plugin modules loading (#12753)

This commit is contained in:
Adrien de Peretti
2025-06-17 19:43:31 +02:00
committed by GitHub
parent 5317f16d54
commit 9bdd5429af
2 changed files with 14 additions and 5 deletions

View File

@@ -37,10 +37,10 @@ export class Compiler {
this.#adminOnlyDistFolder = path.join(this.#projectRoot, ".medusa/admin")
this.#pluginsDistFolder = path.join(this.#projectRoot, ".medusa/server")
this.#backendIgnoreFiles = [
"integration-tests",
"test",
"unit-tests",
"src/admin",
"/integration-tests/",
"/test/",
"/unit-tests/",
"/src/admin/",
]
}
@@ -190,7 +190,7 @@ export class Compiler {
}> {
const ts = await this.#loadTSCompiler()
const filesToCompile = tsConfig.fileNames.filter((fileName) => {
return !chunksToIgnore.some((chunk) => fileName.includes(`${chunk}/`))
return !chunksToIgnore.some((chunk) => fileName.includes(`${chunk}`))
})
/**

View File

@@ -3,6 +3,8 @@ import { MedusaContainer } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
createMedusaContainer,
getResolvedPlugins,
mergePluginModules,
} from "@medusajs/framework/utils"
import { asValue } from "awilix"
import { logger } from "@medusajs/framework/logger"
@@ -141,6 +143,13 @@ class MedusaTestRunner {
const { container, MedusaAppLoader } = await import("@medusajs/framework")
const appLoader = new MedusaAppLoader()
// Load plugins modules
const configModule = container.resolve(
ContainerRegistrationKeys.CONFIG_MODULE
)
const plugins = await getResolvedPlugins(this.cwd, configModule)
mergePluginModules(configModule, plugins)
container.register({
[ContainerRegistrationKeys.LOGGER]: asValue(logger),
})