From 321c271e53e2aa66c689f8a6c215042fed4c4b39 Mon Sep 17 00:00:00 2001 From: Zakaria El Asri <33696020+zakariaelas@users.noreply.github.com> Date: Thu, 16 Dec 2021 14:56:25 +0100 Subject: [PATCH] fix: allow integration tests to run from integration-test/api folder (#940) --- integration-tests/api/jest.config.js | 2 ++ integration-tests/helpers/use-template-db.js | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/integration-tests/api/jest.config.js b/integration-tests/api/jest.config.js index caebf0e68a..087b324f1d 100644 --- a/integration-tests/api/jest.config.js +++ b/integration-tests/api/jest.config.js @@ -13,4 +13,6 @@ module.exports = { ], transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` }, setupFilesAfterEnv: ["../setup.js"], + globalSetup: "../globalSetup.js", + globalTeardown: "../globalTeardown.js", } diff --git a/integration-tests/helpers/use-template-db.js b/integration-tests/helpers/use-template-db.js index 32b2699aa7..e9befaa482 100644 --- a/integration-tests/helpers/use-template-db.js +++ b/integration-tests/helpers/use-template-db.js @@ -16,18 +16,17 @@ const pgGodCredentials = { class DatabaseFactory { constructor() { this.connection_ = null - this.masterConnectionName = "name" + this.masterConnectionName = "master" this.templateDbName = "medusa-integration-template" } async createTemplateDb_() { try { + const cwd = path.resolve(path.join(__dirname, "..")) const connection = await this.getMasterConnection() - const migrationDir = path.resolve( path.join( - process.cwd(), - "integration-tests", + cwd, "api", `node_modules`, `@medusajs`,