diff --git a/test/fixtures/linter/projects/com.ui5.troublesome.app/configs/ui5-custom.yaml b/test/fixtures/linter/projects/com.ui5.troublesome.app/configs/ui5-custom.yaml index 0ea2fb99e..212d8d536 100644 --- a/test/fixtures/linter/projects/com.ui5.troublesome.app/configs/ui5-custom.yaml +++ b/test/fixtures/linter/projects/com.ui5.troublesome.app/configs/ui5-custom.yaml @@ -9,3 +9,7 @@ framework: - name: sap.m - name: sap.ui.core - name: sap.landvisz +resources: + configuration: + paths: + webapp: webapp2 \ No newline at end of file diff --git a/test/fixtures/linter/projects/com.ui5.troublesome.app/webapp2/manifest.json b/test/fixtures/linter/projects/com.ui5.troublesome.app/webapp2/manifest.json new file mode 100644 index 000000000..92d1d8301 --- /dev/null +++ b/test/fixtures/linter/projects/com.ui5.troublesome.app/webapp2/manifest.json @@ -0,0 +1,113 @@ +{ + "_version": "1.12.0", + + "sap.app": { + "id": "com.ui5.troublesome.app", + "type": "application", + "i18n": "i18n/i18n.properties", + "title": "{{appTitle}}", + "description": "{{appDescription}}", + "applicationVersion": { + "version": "1.0.0" + }, + "dataSources": { + "v4": { + "uri": "/api/odata-4/", + "type": "OData", + "settings": { + "odataVersion": "4.0" + } + } + } + }, + + "sap.ui": { + "technology": "UI5", + "icons": {}, + "deviceTypes": { + "desktop": true, + "tablet": true, + "phone": true + } + }, + + "sap.ui5": { + "rootView": { + "viewName": "com.ui5.troublesome.app.view.App", + "type": "XML", + "async": true, + "id": "app" + }, + + "dependencies": { + "minUI5Version": "1.119.0", + "libs": { + "sap.ui.core": {}, + "sap.m": {}, + "sap.ui.commons": {} + } + }, + + "handleValidation": true, + + "contentDensities": { + "compact": true, + "cozy": true + }, + + "resources": { + "js": [{ "uri": "path/to/thirdparty.js" }] + }, + + "models": { + "i18n": { + "type": "sap.ui.model.resource.ResourceModel", + "settings": { + "bundleName": "com.ui5.troublesome.app.i18n.i18n" + } + }, + "odata-v4": { + "type": "sap.ui.model.odata.v4.ODataModel", + "settings": { + "synchronizationMode": "None" + } + }, + "odata-v4-via-dataSource": { + "dataSource": "v4", + "settings": { + "synchronizationMode": "None" + } + }, + "odata": { + "type": "sap.ui.model.odata.ODataModel", + "settings": { + "serviceUrl": "/api/odata" + } + } + }, + + "routing": { + "config": { + "routerClass": "sap.m.routing.Router", + "viewType": "XML", + "viewPath": "com.ui5.troublesome.app.view", + "controlId": "app", + "controlAggregation": "pages", + "async": true + }, + "routes": [ + { + "pattern": "", + "name": "main", + "target": "main" + } + ], + "targets": { + "main": { + "viewId": "main", + "viewName": "Main" + } + } + } + } +} diff --git a/test/lib/linter/linter.ts b/test/lib/linter/linter.ts index 3bb3caf0b..cab58d123 100644 --- a/test/lib/linter/linter.ts +++ b/test/lib/linter/linter.ts @@ -143,7 +143,7 @@ test.serial("lint: All files of com.ui5.troublesome.app with custom config", asy t.snapshot(preprocessLintResultsForSnapshot(res)); }); -test.serial("lint: All files of com.ui5.troublesome.app with custom UI5 config", async (t) => { +test.serial("lint: com.ui5.troublesome.app with custom UI5 config", async (t) => { const projectPath = path.join(fixturesProjectsPath, "com.ui5.troublesome.app"); const {lintProject} = t.context; @@ -157,3 +157,17 @@ test.serial("lint: All files of com.ui5.troublesome.app with custom UI5 config", t.snapshot(preprocessLintResultsForSnapshot(res)); }); + +test.only("lint: com.ui5.troublesome.app with custom UI5 config which does NOT exist", async (t) => { + const projectPath = path.join(fixturesProjectsPath, "com.ui5.troublesome.app"); + const {lintProject} = t.context; + const ui5ConfigPath = "./configs/ui5-DOES-NOT-EXIST.yaml"; + + await t.throwsAsync(lintProject({ + rootDir: projectPath, + pathsToLint: [], + reportCoverage: true, + includeMessageDetails: true, + ui5ConfigPath, + }), {message: `Unable to find UI5 config file '${ui5ConfigPath}'`}); +}); diff --git a/test/lib/linter/snapshots/linter.ts.md b/test/lib/linter/snapshots/linter.ts.md index 6c4de2e5a..5477e215c 100644 --- a/test/lib/linter/snapshots/linter.ts.md +++ b/test/lib/linter/snapshots/linter.ts.md @@ -1674,113 +1674,11 @@ Generated by [AVA](https://avajs.dev). ], warningCount: 0, }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/Component.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [ - { - category: 1, - column: 33, - line: 8, - message: 'Unable to analyze this method call because the type of identifier "getContentDensityClass" in "this.getOwnerComponent().getContentDensityClass()"" could not be determined', - }, - ], - errorCount: 2, - fatalErrorCount: 0, - filePath: 'webapp/controller/App.controller.js', - messages: [ - { - column: 36, - line: 1, - message: 'Deprecated access to enum pseudo module \'sap/m/BackgroundDesign\'', - messageDetails: 'Migrating Access to Pseudo Modules (https://ui5.sap.com/#/topic/00737d6c1b864dc3ab72ef56611491c4)', - ruleId: 'no-pseudo-modules', - severity: 2, - }, - { - column: 24, - line: 10, - message: 'Call to deprecated function \'attachTap\' of class \'Button\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, - { - coverageInfo: [ - { - category: 1, - column: 17, - line: 38, - message: 'Unable to analyze this method call because the type of identifier "getModel" in "this.getOwnerComponent().getModel("i18n")"" could not be determined', - }, - { - category: 1, - column: 11, - line: 39, - message: 'Unable to analyze this method call because the type of identifier "getResourceBundle" in "oModel.getResourceBundle()"" could not be determined', - }, - ], - errorCount: 2, - fatalErrorCount: 0, - filePath: 'webapp/controller/BaseController.js', - messages: [ - { - column: 5, - line: 9, - message: 'Use of deprecated property \'blocked\' of class \'Button\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 8, - line: 11, - message: 'Call to deprecated function \'attachTap\' of class \'Button\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/controller/Main.controller.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/emptyFile.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/helpers/ES6Class.helper.js', - messages: [], - warningCount: 0, - }, { coverageInfo: [], errorCount: 5, fatalErrorCount: 0, - filePath: 'webapp/manifest.json', + filePath: 'webapp2/manifest.json', messages: [ { column: 17, @@ -1824,355 +1722,4 @@ Generated by [AVA](https://avajs.dev). ], warningCount: 0, }, - { - coverageInfo: [ - { - category: 1, - column: 20, - line: 6, - message: 'Unable to analyze this method call because the type of identifier "toUpperCase" in "value.toUpperCase()"" could not be determined', - }, - ], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/model/formatter.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/model/models.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [ - { - category: 1, - column: 2, - line: 6, - message: `Unable to analyze this method call because the type of identifier in "opaTest("Should open the Hello dialog", function (Given, When, Then) {␊ - // Arrangements␊ - Given.iStartMyUIComponent({␊ - componentConfig: {␊ - name: "com.ui5.troublesome.app"␊ - }␊ - });␊ - // Actions␊ - When.onTheMainPage.iPressTheSayHelloButton();␊ - // Assertions␊ - Then.onTheMainPage.iShouldSeeTheHelloDialog();␊ - // Actions␊ - When.onTheMainPage.iPressTheOkButtonInTheDialog();␊ - // Assertions␊ - Then.onTheMainPage.iShouldNotSeeTheHelloDialog();␊ - // Cleanup␊ - Then.iTeardownMyApp();␊ - })"" could not be determined`, - }, - { - category: 1, - column: 3, - line: 8, - message: `Unable to analyze this method call because the type of identifier "iStartMyUIComponent" in "Given.iStartMyUIComponent({␊ - componentConfig: {␊ - name: "com.ui5.troublesome.app"␊ - }␊ - })"" could not be determined`, - }, - { - category: 1, - column: 3, - line: 15, - message: 'Unable to analyze this method call because the type of identifier "iPressTheSayHelloButton" in "When.onTheMainPage.iPressTheSayHelloButton()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 18, - message: 'Unable to analyze this method call because the type of identifier "iShouldSeeTheHelloDialog" in "Then.onTheMainPage.iShouldSeeTheHelloDialog()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 21, - message: 'Unable to analyze this method call because the type of identifier "iPressTheOkButtonInTheDialog" in "When.onTheMainPage.iPressTheOkButtonInTheDialog()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 24, - message: 'Unable to analyze this method call because the type of identifier "iShouldNotSeeTheHelloDialog" in "Then.onTheMainPage.iShouldNotSeeTheHelloDialog()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 27, - message: 'Unable to analyze this method call because the type of identifier "iTeardownMyApp" in "Then.iTeardownMyApp()"" could not be determined', - }, - { - category: 1, - column: 2, - line: 30, - message: `Unable to analyze this method call because the type of identifier in "opaTest("Should close the Hello dialog", function (Given, When, Then) {␊ - // Arrangements␊ - Given.iStartMyUIComponent({␊ - componentConfig: {␊ - name: "com.ui5.troublesome.app"␊ - }␊ - });␊ - // Actions␊ - When.onTheMainPage.iPressTheSayHelloButton();␊ - When.onTheMainPage.iPressTheOkButtonInTheDialog();␊ - // Assertions␊ - Then.onTheMainPage.iShouldNotSeeTheHelloDialog();␊ - // Cleanup␊ - Then.iTeardownMyApp();␊ - })"" could not be determined`, - }, - { - category: 1, - column: 3, - line: 32, - message: `Unable to analyze this method call because the type of identifier "iStartMyUIComponent" in "Given.iStartMyUIComponent({␊ - componentConfig: {␊ - name: "com.ui5.troublesome.app"␊ - }␊ - })"" could not be determined`, - }, - { - category: 1, - column: 3, - line: 39, - message: 'Unable to analyze this method call because the type of identifier "iPressTheSayHelloButton" in "When.onTheMainPage.iPressTheSayHelloButton()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 40, - message: 'Unable to analyze this method call because the type of identifier "iPressTheOkButtonInTheDialog" in "When.onTheMainPage.iPressTheOkButtonInTheDialog()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 43, - message: 'Unable to analyze this method call because the type of identifier "iShouldNotSeeTheHelloDialog" in "Then.onTheMainPage.iShouldNotSeeTheHelloDialog()"" could not be determined', - }, - { - category: 1, - column: 3, - line: 46, - message: 'Unable to analyze this method call because the type of identifier "iTeardownMyApp" in "Then.iTeardownMyApp()"" could not be determined', - }, - ], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/test/integration/HelloJourney.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 3, - fatalErrorCount: 0, - filePath: 'webapp/test/integration/opaTests.qunit.js', - messages: [ - { - column: 18, - line: 4, - message: 'Call to deprecated function \'attachInit\' of class \'Core\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 8, - line: 4, - message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 1, - line: 4, - message: 'Access of global variable \'sap\' (sap.ui.getCore)', - ruleId: 'no-globals', - severity: 2, - }, - ], - warningCount: 0, - }, - { - coverageInfo: [ - { - category: 1, - column: 13, - line: 8, - message: `Unable to analyze this method call because the type of identifier "waitFor" in "this.waitFor({␊ - id: "helloButton",␊ - viewName: "com.ui5.troublesome.app.view.Main",␊ - actions: new Press(),␊ - errorMessage: "Did not find the 'Say Hello With Dialog' button on the App view"␊ - })"" could not be determined`, - }, - { - category: 1, - column: 13, - line: 17, - message: `Unable to analyze this method call because the type of identifier "waitFor" in "this.waitFor({␊ - controlType: "sap.m.Button",␊ - searchOpenDialogs: true,␊ - viewName: "com.ui5.troublesome.app.view.Main",␊ - actions: new Press(),␊ - errorMessage: "Did not find the 'OK' button in the Dialog"␊ - })"" could not be determined`, - }, - { - category: 1, - column: 13, - line: 29, - message: `Unable to analyze this method call because the type of identifier "waitFor" in "this.waitFor({␊ - controlType: "sap.m.Dialog",␊ - success: function () {␊ - // we set the view busy, so we need to query the parent of the app␊ - Opa5.assert.ok(true, "The dialog is open");␊ - },␊ - errorMessage: "Did not find the dialog control"␊ - })"" could not be determined`, - }, - { - category: 1, - column: 13, - line: 40, - message: `Unable to analyze this method call because the type of identifier "waitFor" in "this.waitFor({␊ - controlType: "sap.m.App", // dummy, I just want a check function, where I can search the DOM. Probably there is a better way for a NEGATIVE test (NO dialog).␊ - check: function () {␊ - return document.querySelectorAll(".sapMDialog").length === 0;␊ - },␊ - success: function () {␊ - Opa5.assert.ok(true, "No dialog is open");␊ - }␊ - })"" could not be determined`, - }, - ], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/test/integration/pages/Main.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/test/testsuite.qunit.html', - messages: [ - { - column: 3, - line: 12, - message: 'Use of unsafe inline script', - messageDetails: 'Content Security Policy (https://ui5.sap.com/#/topic/fe1a6dba940e479fb7c3bc753f92b28c)', - ruleId: 'csp-unsafe-inline-script', - severity: 1, - }, - ], - warningCount: 1, - }, - { - coverageInfo: [ - { - category: 1, - column: 2, - line: 6, - message: 'Unable to analyze this method call because the type of identifier "addTestPage" in "suite.addTestPage(sContextPath + "unit/unitTests.qunit.html")"" could not be determined', - }, - { - category: 1, - column: 2, - line: 7, - message: 'Unable to analyze this method call because the type of identifier "addTestPage" in "suite.addTestPage(sContextPath + "integration/opaTests.qunit.html")"" could not be determined', - }, - ], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/test/testsuite.qunit.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/test/unit/controller/App.qunit.js', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 3, - fatalErrorCount: 0, - filePath: 'webapp/test/unit/unitTests.qunit.js', - messages: [ - { - column: 18, - line: 6, - message: 'Call to deprecated function \'attachInit\' of class \'Core\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 8, - line: 6, - message: 'Call to deprecated function \'getCore\' (sap.ui.getCore)', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 1, - line: 6, - message: 'Access of global variable \'sap\' (sap.ui.getCore)', - ruleId: 'no-globals', - severity: 2, - }, - ], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 0, - fatalErrorCount: 0, - filePath: 'webapp/view/App.view.xml', - messages: [], - warningCount: 0, - }, - { - coverageInfo: [], - errorCount: 2, - fatalErrorCount: 0, - filePath: 'webapp/view/Main.view.xml', - messages: [ - { - column: 2, - line: 11, - message: 'Import of deprecated module \'sap/m/MessagePage\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - { - column: 5, - line: 22, - message: 'Use of deprecated property \'blocked\' of class \'Button\'', - messageDetails: 'Deprecated test message', - ruleId: 'no-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, ] diff --git a/test/lib/linter/snapshots/linter.ts.snap b/test/lib/linter/snapshots/linter.ts.snap index be61e5b2a..a13ad3f88 100644 Binary files a/test/lib/linter/snapshots/linter.ts.snap and b/test/lib/linter/snapshots/linter.ts.snap differ