diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index b00b3b0c31..6a732a9591 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,10 +16,15 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/backend-core": "/../backend-core/src", "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", - "@budibase/pro": "/../pro/packages/pro/src", }, } +// add pro sources if they exist +if (fs.existsSync("../pro/packages")) { + baseConfig.moduleNameMapper!["@budibase/pro"] = + "/../pro/packages/pro/src" +} + const config: Config.InitialOptions = { projects: [ { diff --git a/packages/worker/jest.config.ts b/packages/worker/jest.config.ts index 01a2dd54fd..2b0d8fe23b 100644 --- a/packages/worker/jest.config.ts +++ b/packages/worker/jest.config.ts @@ -16,9 +16,15 @@ const config: Config.InitialOptions = { "@budibase/backend-core/(.*)": "/../backend-core/$1", "@budibase/backend-core": "/../backend-core/src", "@budibase/types": "/../types/src", - "@budibase/pro/(.*)": "/../pro/packages/pro/$1", - "@budibase/pro": "/../pro/packages/pro/src", }, } +// add pro sources if they exist +if (fs.existsSync("../pro/packages")) { + config.moduleNameMapper!["@budibase/pro/(.*)"] = + "/../pro/packages/pro/$1" + config.moduleNameMapper!["@budibase/pro"] = + "/../pro/packages/pro/src" +} + export default config