From ecbf9250a4ee86eaf55ac2320d57869b153d149d Mon Sep 17 00:00:00 2001 From: adrinr Date: Fri, 27 Jan 2023 12:36:52 +0000 Subject: [PATCH] Add module name mapper back --- packages/worker/jest.config.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/worker/jest.config.ts b/packages/worker/jest.config.ts index 0d06446862..85f554f8da 100644 --- a/packages/worker/jest.config.ts +++ b/packages/worker/jest.config.ts @@ -1,10 +1,7 @@ import { Config } from "@jest/types" import * as fs from "fs" -const preset = require("ts-jest/jest-preset") const config: Config.InitialOptions = { - ...preset, - preset: "@trendyol/jest-testcontainers", testEnvironment: "node", setupFiles: ["./src/tests/jestEnv.ts"], setupFilesAfterEnv: ["./src/tests/jestSetup.ts"], @@ -15,4 +12,22 @@ const config: Config.InitialOptions = { }, } +if (!process.env.CI) { + // use sources when not in CI + config.moduleNameMapper = { + "@budibase/backend-core/(.*)": "/../backend-core/$1", + "@budibase/backend-core": "/../backend-core/src", + "@budibase/types": "/../types/src", + } + // add pro sources if they exist + if (fs.existsSync("../../../budibase-pro")) { + config.moduleNameMapper["@budibase/pro/(.*)"] = + "/../../../budibase-pro/packages/pro/$1" + config.moduleNameMapper["@budibase/pro"] = + "/../../../budibase-pro/packages/pro/src" + } +} else { + console.log("Running tests with compiled dependency sources") +} + export default config