diff --git a/lib/framework.js b/lib/framework.js index 2d2b529e..5fb14121 100644 --- a/lib/framework.js +++ b/lib/framework.js @@ -302,7 +302,9 @@ export default class Framework { if (this.config.ui5.type) { return; } - const filePath = path.join(this.config.basePath, "ui5.yaml"); + const {ui5: {configPath}, basePath} = this.config; + const filePath = configPath ? + path.resolve(basePath, configPath) : path.join(basePath, "ui5.yaml"); let fileContent; try { fileContent = readFileSync(filePath); diff --git a/test/unit/framework.js b/test/unit/framework.js index 334913b7..fa42a198 100644 --- a/test/unit/framework.js +++ b/test/unit/framework.js @@ -212,6 +212,20 @@ test("UI5 Middleware / Proxy configuration: Should setup UI5 tooling middleware t.deepEqual(setupUI5Server.lastCall.args, [{basePath: "", configPath: undefined}]); }); +test("ui5.yaml: should be configurable when autoDetectType", + async (t) => { + const {framework, logger, readFileSyncStub, sinon} = t.context; + const autoDetectTypeSpy = sinon.spy(framework, "autoDetectType"); + const mockUI5YamlPath = "../ui5/yaml/ui5-custom.yaml"; + + framework.exists = () => true; + framework.init({config: {ui5: {configPath: mockUI5YamlPath}, basePath: "/alternative/app"}, logger}); + + t.true(autoDetectTypeSpy.calledOnce, "autoDetectType is called"); + t.deepEqual(readFileSyncStub.lastCall.args, [path.resolve("/alternative/app", mockUI5YamlPath)], + "Custom ui5.yaml is provided"); + }); + // Sad path test("UI5 Middleware / Proxy configuration: Should throw if ui5.yaml is missing and no url is configured", async (t) => {