diff --git a/packages/backend-core/jest.config.ts b/packages/backend-core/jest.config.ts index 059d3d2a43..133c25734e 100644 --- a/packages/backend-core/jest.config.ts +++ b/packages/backend-core/jest.config.ts @@ -13,4 +13,13 @@ const config: Config.InitialOptions = { }, } +if (!process.env.CI) { + // use sources when not in CI + config.moduleNameMapper = { + "@budibase/types": "/../types/src", + } +} else { + console.log("Running tests with compiled dependency sources") +} + export default config diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index c261d109c9..7d5c202f15 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -18,4 +18,20 @@ 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/src" + } +} else { + console.log("Running tests with compiled dependency sources") +} + export default config diff --git a/packages/server/src/automations/tests/automation.spec.js b/packages/server/src/automations/tests/automation.spec.js index 4a9f7e2f79..59ee531e9b 100644 --- a/packages/server/src/automations/tests/automation.spec.js +++ b/packages/server/src/automations/tests/automation.spec.js @@ -29,9 +29,9 @@ describe("Run through some parts of the automations system", () => { afterAll(setup.afterAll) it("should be able to init in builder", async () => { - await triggers.externalTrigger(basicAutomation(), { a: 1, appId: "app_123" }) - await wait(100) - expect(thread.execute).toHaveBeenCalled() + await triggers.externalTrigger(basicAutomation(), { a: 1, appId: config.appId }) + await wait(100) + expect(thread.execute).toHaveBeenCalled() }) it("should check coercion", async () => { diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index ff9c82d367..15f090035a 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -399,11 +399,11 @@ class TestConfiguration { // clear any old app this.appId = null // @ts-ignore - await context.updateAppId(null) + context.updateAppId(null) this.app = await this._req({ name: appName }, null, controllers.app.create) this.appId = this.app.appId // @ts-ignore - await context.updateAppId(this.appId) + context.updateAppId(this.appId) // create production app this.prodApp = await this.publish()