fix: make sure @medusajs/medusa is loaded correctly regardless of integration test suite being run (#1166)

This commit is contained in:
Zakaria El Asri
2022-03-09 17:20:18 +01:00
committed by GitHub
parent 4e7435e4d7
commit 8e7de6dd36
3 changed files with 5 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
// API
process.chdir(__dirname)
module.exports = {
name: "api",

View File

@@ -1,5 +1,6 @@
const dbFactory = require("./helpers/use-template-db")
const path = require("path")
module.exports = async () => {
await dbFactory.createTemplateDb_()
await dbFactory.createTemplateDb_({ cwd: path.resolve(".") })
}

View File

@@ -20,14 +20,13 @@ class DatabaseFactory {
this.templateDbName = "medusa-integration-template"
}
async createTemplateDb_() {
async createTemplateDb_({ cwd }) {
try {
const cwd = path.resolve(path.join(__dirname, ".."))
// const cwd = path.resolve(path.join(__dirname, ".."))
const connection = await this.getMasterConnection()
const migrationDir = path.resolve(
path.join(
cwd,
"api",
`node_modules`,
`@medusajs`,
`medusa`,