Skip to content

Commit 9bdd542

Browse files
authored
fix(core, medusa-test-utils): Fix medusa test runner plugin modules loading (medusajs#12753)
1 parent 5317f16 commit 9bdd542

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

packages/core/framework/src/build-tools/compiler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ export class Compiler {
3737
this.#adminOnlyDistFolder = path.join(this.#projectRoot, ".medusa/admin")
3838
this.#pluginsDistFolder = path.join(this.#projectRoot, ".medusa/server")
3939
this.#backendIgnoreFiles = [
40-
"integration-tests",
41-
"test",
42-
"unit-tests",
43-
"src/admin",
40+
"/integration-tests/",
41+
"/test/",
42+
"/unit-tests/",
43+
"/src/admin/",
4444
]
4545
}
4646

@@ -190,7 +190,7 @@ export class Compiler {
190190
}> {
191191
const ts = await this.#loadTSCompiler()
192192
const filesToCompile = tsConfig.fileNames.filter((fileName) => {
193-
return !chunksToIgnore.some((chunk) => fileName.includes(`${chunk}/`))
193+
return !chunksToIgnore.some((chunk) => fileName.includes(`${chunk}`))
194194
})
195195

196196
/**

packages/medusa-test-utils/src/medusa-test-runner.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { MedusaContainer } from "@medusajs/framework/types"
33
import {
44
ContainerRegistrationKeys,
55
createMedusaContainer,
6+
getResolvedPlugins,
7+
mergePluginModules,
68
} from "@medusajs/framework/utils"
79
import { asValue } from "awilix"
810
import { logger } from "@medusajs/framework/logger"
@@ -141,6 +143,13 @@ class MedusaTestRunner {
141143
const { container, MedusaAppLoader } = await import("@medusajs/framework")
142144
const appLoader = new MedusaAppLoader()
143145

146+
// Load plugins modules
147+
const configModule = container.resolve(
148+
ContainerRegistrationKeys.CONFIG_MODULE
149+
)
150+
const plugins = await getResolvedPlugins(this.cwd, configModule)
151+
mergePluginModules(configModule, plugins)
152+
144153
container.register({
145154
[ContainerRegistrationKeys.LOGGER]: asValue(logger),
146155
})

0 commit comments

Comments
 (0)