@zohodesk/testinglibrary 0.1.8-eslint-3 → 0.1.8-eslint-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,9 @@ exports.sonarQubeIntegrateAnalysis = sonarQubeIntegrateAnalysis;
8
8
  var _sonarqubeScanner = _interopRequireDefault(require("sonarqube-scanner"));
9
9
  var _readConfigFile = require("../core/playwright/readConfigFile");
10
10
  var _path = _interopRequireDefault(require("path"));
11
+ var _pipelineLintStage = require("./pipelineLintStage");
12
+ // Js script to start sonar Server
13
+
11
14
  const postCallBack = () => process.exit();
12
15
  const serverHostUrl = 'https://serverlinter-np.zohodesk.csez.zohocorpin.com';
13
16
  const options = {
@@ -17,7 +20,8 @@ const options = {
17
20
  'sonar.sources': '',
18
21
  'sonar.tests': `${_path.default.resolve(process.cwd(), 'uat', 'modules')}`,
19
22
  'sonar.language': 'js',
20
- 'sonar.eslint.reportPaths': `${_path.default.resolve(process.cwd(), 'uat', 'eslint-report', 'lintReport.json')}`
23
+ 'sonar.eslint.reportPaths': `${_path.default.resolve(process.cwd(), 'uat', 'eslint-report', 'lintReport.json')}`,
24
+ 'sonar.working.directory': `${_path.default.resolve(process.cwd(), 'uat', 'modules', '.scannerwork')}`
21
25
  };
22
26
  function sonarQubeIntegrateAnalysis() {
23
27
  (0, _sonarqubeScanner.default)({
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getDiffFiles = getDiffFiles;
8
+ exports.runEslintForDiff = runEslintForDiff;
9
+ var _getFilePath = require("../utils/getFilePath");
10
+ var _child_process = require("child_process");
11
+ var _path = _interopRequireDefault(require("path"));
12
+ var _logger = require("../utils/logger");
13
+ var _cliArgsToObject = require("../utils/cliArgsToObject");
14
+ // function gitDiffFiles() {
15
+ // const childProcess = spawnSync('git', [
16
+ // 'diff',
17
+ // 'HEAD',
18
+ // 'HEAD~1',
19
+ // '--name-only'
20
+ // ]);
21
+ // const diff_Files = childProcess.stdout.toString().split('\n').filter(Boolean);
22
+ // var actualDiff_Files = diff_Files.map(filePath => {
23
+ // var fileName = path.basename(filePath);
24
+ // if (
25
+ // filePath.includes('/page-object-model/') ||
26
+ // filePath.includes('/assertions/')
27
+ // ) {
28
+ // return path.resolve(process.cwd(), '../', '../', filePath);
29
+ // }
30
+ // if (fileName.includes('.spec.js')) {
31
+ // return path.resolve(process.cwd(), '../', '../', filePath);
32
+ // }
33
+ // return false;
34
+ // });
35
+ // return actualDiff_Files;
36
+ // }
37
+
38
+ function runEslintForDiff(cliParams, options = {}) {
39
+ // $(git diff --name-only HEAD HEAD~1 | grep -E '\.(js|jsx)$' | xargs)
40
+ const {
41
+ diffPath
42
+ } = (0, _cliArgsToObject.cliArgsToObject)(cliParams);
43
+ const format = 'json';
44
+ const reportPath = _path.default.resolve(process.cwd(), 'uat', 'eslint-report', 'lintReport.json');
45
+ const diffJSON = require(diffPath);
46
+ return new Promise(resolve => {
47
+ (0, _child_process.exec)(`npx eslint ${getDiffFiles(diffJSON).join(" ")} --format=${format} -o ${reportPath}`, (stdout, stderr) => {
48
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, stderr);
49
+ resolve(stdout);
50
+ });
51
+ });
52
+ }
53
+ function getImpactsLine() {
54
+ const diffJson = _path.default.resolve(process.cwd(), 'diffContents.json');
55
+ return filterDiffJson(diffJson);
56
+ }
57
+ function filterDiffJson(diffJson) {
58
+ var _diffJson$diffs;
59
+ let matches = [];
60
+ diffJson === null || diffJson === void 0 || (_diffJson$diffs = diffJson.diffs) === null || _diffJson$diffs === void 0 || _diffJson$diffs.forEach(diff => {
61
+ const diffMatch = [];
62
+ const regex = /@@(.*?)@@/g;
63
+ let match;
64
+ while ((match = regex.exec(diff.diff)) !== null) {
65
+ diffMatch.push(match[1]);
66
+ }
67
+ matches.push({
68
+ pathFile: diff.new_path,
69
+ diff: diffMatch
70
+ });
71
+ });
72
+ return matches;
73
+ }
74
+ function getDiffFiles(diffJson) {
75
+ return diffJson === null || diffJson === void 0 ? void 0 : diffJson.diffs.map(diff => {
76
+ return diff === null || diff === void 0 ? void 0 : diff.new_path;
77
+ });
78
+ }
79
+ function validateReport() {
80
+ if (1) {} else {
81
+ throw new Error('Report Failed');
82
+ process.exit(1);
83
+ }
84
+ }
85
+ function parseJsonReport() {
86
+ const parsejson = _path.default.resolve(process.cwd(), 'uat', 'eslint-report', 'lintReport.json');
87
+ }
@@ -0,0 +1,39 @@
1
+ import subprocess
2
+
3
+ # params Hardcoding
4
+
5
+ def run_sonar_analysis():
6
+ project_key = "UAT_Testing"
7
+ project_name = "developer"
8
+ sonar_token = "developer"
9
+ sonarqube_host_url = "https://serverlinter-np.zohodesk.csez.zohocorpin.com/"
10
+ sonar_scanner_path = "./sonar-scanner-cli-4.8.0.2856.jar" # Path to your SonarScanner executable
11
+ source_directories = [
12
+ "./uat/modules/Setup/feature-files/SetupMenuCategories.feature",
13
+ "./uat/modules/Setup/feature-files/SetupMenuPanelHide.feature",
14
+ "./uat/modules/Setup/feature-files/SearchClear.feature",
15
+ ]
16
+
17
+ # Convert array to a comma-separated string
18
+ source_directories_str = ",".join(source_directories)
19
+
20
+ # SonarScanner command
21
+ command = [
22
+ "java",
23
+ "-jar",
24
+ sonar_scanner_path,
25
+ "-Dsonar.host.url=" + sonarqube_host_url ,
26
+ "-Dsonar.projectKey=" + project_key,
27
+ "-Dsonar.login=" + project_name,
28
+ "-Dsonar.password=" + sonar_token,
29
+ "-Dsonar.sources=" + source_directories_str, # Specify the source directory for your JavaScript files # Specify the test directory for your JavaScript test files
30
+ "-Dsonar.language=js",
31
+ "-Dsonar.javascript.lcov.reportPaths=coverage/lcov-report/lcov.info", # If you have code coverage reports
32
+ "-Dsonar.eslint.eslintconfigpath=./eslintrc.js"
33
+ ]
34
+
35
+ # Run SonarScanner
36
+ subprocess.run(command)
37
+
38
+ if __name__ == "__main__":
39
+ run_sonar_analysis()
package/build/lib/cli.js CHANGED
@@ -9,8 +9,8 @@ var _setupProject = _interopRequireDefault(require("../setup-folder-structure/se
9
9
  var _parser = require("../parser/parser");
10
10
  var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-caches"));
11
11
  var _helper = _interopRequireDefault(require("../setup-folder-structure/helper"));
12
- var _pipelineLintStage = require("../integrateEslintReport/pipelineLintStage");
13
- var _EslintSonarQube_Integrate = require("../integrateEslintReport/Eslint-sonarQube_Integrate");
12
+ var _pipelineLintStage = require("../eslint-ci/pipelineLintStage");
13
+ var _eslint_serverReport = require("../eslint-ci/eslint_serverReport");
14
14
  // import createJestRunner from '../core/jest/runner/jest-runner';
15
15
 
16
16
  _pipelineLintStage.runEslintForDiff;
@@ -60,8 +60,10 @@ switch (option) {
60
60
  case 'lint-ci':
61
61
  {
62
62
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Linting Started ...');
63
- (0, _pipelineLintStage.runEslintForDiff)();
64
- (0, _EslintSonarQube_Integrate.sonarQubeIntegrateAnalysis)();
63
+ (0, _pipelineLintStage.runEslintForDiff)(otherOptions).then(result => {
64
+ (0, _eslint_serverReport.sonarQubeIntegrateAnalysis)();
65
+ });
66
+ break;
65
67
  }
66
68
  case 'help':
67
69
  default:
@@ -14,7 +14,10 @@ const reportRelativepath = path.relative(gitIgnoreAbsolutePath, reportPath)
14
14
  const absolutePathfeaturegen = path.resolve(process.cwd(), 'uat', '.features-gen');
15
15
  const featuregenRelativePath = path.relative(gitIgnoreAbsolutePath,absolutePathfeaturegen)
16
16
 
17
- const dirpathtoIgnore = `${testResultsRelativepath}\n${reportRelativepath}\n${featuregenRelativePath}`
17
+ const absolutePathScannerworkFolder = path.resolve(process.cwd(),'uat','.scanerwork')
18
+ const scannerWorkPath = path.relative(gitIgnoreAbsolutePath,absolutePathScannerworkFolder)
19
+
20
+ const dirpathtoIgnore = `/${testResultsRelativepath}\n/${reportRelativepath}\n/${featuregenRelativePath}\n/${scannerWorkPath}`
18
21
 
19
22
  function updateGitIgnore() {
20
23
  if (existsSync(path.resolve(process.cwd(), '../', '../', '.gitignore'))) {
package/lintjson.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "commit": {
3
+ "id": "d5aeaa7b1b52fad9ab1eb02a5a4dd0a5081e21c7",
4
+ "short_id": "d5aeaa7b",
5
+ "created_at": "2024-02-16T15:40:17.000+05:30",
6
+ "parent_ids": [
7
+ "2817165513e7f8dcfb0d99fc3fa38bc28e4da123",
8
+ "0f657a0901f57ead811f593125ba25b729cb0922"
9
+ ],
10
+ "title": "Merge branch 'release' into 'AK_Integration_Bugfix_Branch'",
11
+ "message": "Merge branch 'release' into 'AK_Integration_Bugfix_Branch'\n\nBPM AutoMerge from release to AK_Integration_Bugfix_Branch\n\nSee merge request zohodesk/zohodesk!43723",
12
+ "author_name": "senthamil",
13
+ "author_email": "senthamil@zohocorp.com",
14
+ "authored_date": "2024-02-16T15:40:17.000+05:30",
15
+ "committer_name": "senthamil",
16
+ "committer_email": "senthamil@zohocorp.com",
17
+ "committed_date": "2024-02-16T15:40:17.000+05:30",
18
+ "trailers": {},
19
+ "web_url": "https://zgit.csez.zohocorpin.com/zohodesk/zohodesk/-/commit/d5aeaa7b1b52fad9ab1eb02a5a4dd0a5081e21c7"
20
+ },
21
+ "commits": [
22
+ {
23
+ "id": "fece5d751c764bf274dc79351c3f265da5388ea5",
24
+ "short_id": "fece5d75",
25
+ "created_at": "2024-02-09T18:09:55.000+05:30",
26
+ "parent_ids": ["93387e0fe8fd7a443c9c18049b448f7321579546"],
27
+ "title": "BugTracker API handling for edit permission",
28
+ "message": "BugTracker API handling for edit permission\n",
29
+ "author_name": "Aravind Kumar",
30
+ "author_email": "aravind-14777@zohocorp.com",
31
+ "authored_date": "2024-02-09T18:09:55.000+05:30",
32
+ "committer_name": "Aravind Kumar",
33
+ "committer_email": "aravind-14777@zohocorp.com",
34
+ "committed_date": "2024-02-09T18:09:55.000+05:30",
35
+ "trailers": {},
36
+ "web_url": "https://zgit.csez.zohocorpin.com/zohodesk/zohodesk/-/commit/fece5d751c764bf274dc79351c3f265da5388ea5"
37
+ },
38
+ {
39
+ "id": "2817165513e7f8dcfb0d99fc3fa38bc28e4da123",
40
+ "short_id": "28171655",
41
+ "created_at": "2024-02-15T18:19:09.000+05:30",
42
+ "parent_ids": [
43
+ "fece5d751c764bf274dc79351c3f265da5388ea5",
44
+ "2d74a78de947f775509c2cd28a5c1bb18a6e8c89"
45
+ ],
46
+ "title": "Merge remote-tracking branch 'origin/release' into AK_Integration_Bugfix_Branch",
47
+ "message": "Merge remote-tracking branch 'origin/release' into AK_Integration_Bugfix_Branch\n",
48
+ "author_name": "Aravind Kumar",
49
+ "author_email": "aravind-14777@zohocorp.com",
50
+ "authored_date": "2024-02-15T18:19:09.000+05:30",
51
+ "committer_name": "Aravind Kumar",
52
+ "committer_email": "aravind-14777@zohocorp.com",
53
+ "committed_date": "2024-02-15T18:19:09.000+05:30",
54
+ "trailers": {},
55
+ "web_url": "https://zgit.csez.zohocorpin.com/zohodesk/zohodesk/-/commit/2817165513e7f8dcfb0d99fc3fa38bc28e4da123"
56
+ },
57
+ {
58
+ "id": "d5aeaa7b1b52fad9ab1eb02a5a4dd0a5081e21c7",
59
+ "short_id": "d5aeaa7b",
60
+ "created_at": "2024-02-16T15:40:17.000+05:30",
61
+ "parent_ids": [
62
+ "2817165513e7f8dcfb0d99fc3fa38bc28e4da123",
63
+ "0f657a0901f57ead811f593125ba25b729cb0922"
64
+ ],
65
+ "title": "Merge branch 'release' into 'AK_Integration_Bugfix_Branch'",
66
+ "message": "Merge branch 'release' into 'AK_Integration_Bugfix_Branch'\n\nBPM AutoMerge from release to AK_Integration_Bugfix_Branch\n\nSee merge request zohodesk/zohodesk!43723",
67
+ "author_name": "senthamil",
68
+ "author_email": "senthamil@zohocorp.com",
69
+ "authored_date": "2024-02-16T15:40:17.000+05:30",
70
+ "committer_name": "senthamil",
71
+ "committer_email": "senthamil@zohocorp.com",
72
+ "committed_date": "2024-02-16T15:40:17.000+05:30",
73
+ "trailers": {},
74
+ "web_url": "https://zgit.csez.zohocorpin.com/zohodesk/zohodesk/-/commit/d5aeaa7b1b52fad9ab1eb02a5a4dd0a5081e21c7"
75
+ }
76
+ ],
77
+ "diffs": [
78
+ {
79
+ "old_path": "source/com/adventnet/support/bugs/util/BugIntegUtil.java",
80
+ "new_path": "source/com/adventnet/support/bugs/util/BugIntegUtil.java",
81
+ "a_mode": "100644",
82
+ "b_mode": "100644",
83
+ "new_file": false,
84
+ "renamed_file": false,
85
+ "deleted_file": false,
86
+ "diff": "@@ -78,6 +78,7 @@ import com.adventnet.support.integ.common.IntegConfigUtil;\n import com.adventnet.support.integ.common.IntegConfigUtil.IntegrationTypes;\n import com.adventnet.support.integ.common.IntegInfo;\n import com.adventnet.support.integ.common.IntegUtil;\n+import com.adventnet.support.integ.common.IntegrationModulePermissionsHandler;\n import com.adventnet.support.integ.common.IntegrationConstants.IntegType;\n import com.adventnet.support.integ.feed.util.AcsUtil;\n import com.adventnet.support.integ.feed.util.FeedConstants;\n@@ -408,6 +409,10 @@ public class BugIntegUtil\n \t\t\t{\n \t\t\t\treturn \"{\\\"error\\\":\\\"Insufficient Previlleges to perform this operation.\\\"}\";\n \t\t\t}\n+\t\t\tIntegrationModulePermissionsHandler permissionHandler = new IntegrationModulePermissionsHandler(userId, caseId);\n+\t\t\tif(!permissionHandler.getIsTicketUpdatable()) {\n+\t\t\t\tthrow new AuthorizationException(AuthorizedRequestAPIImpl.NOT_ALLOWED_MESSAGE);\n+\t\t\t}\n \t\t\tRequest request = Support.getRequestAPI().get(caseId);\n \t\t\tString caseNumber =request.requestNumber();\n \t\t\tHashMap<String,Object> params = new HashMap<String,Object>();\n@@ -750,6 +755,10 @@ public class BugIntegUtil\n \t\t\t{\n \t\t\t\treturn bugRespJson.put(\"message\",\"Insufficient Previlleges to perform this operation.\");\n \t\t\t}\n+\t\t\tIntegrationModulePermissionsHandler permissionHandler = new IntegrationModulePermissionsHandler(userId, caseId);\n+\t\t\tif(!permissionHandler.getIsTicketUpdatable()) {\n+\t\t\t\tthrow new AuthorizationException(AuthorizedRequestAPIImpl.NOT_ALLOWED_MESSAGE);\n+\t\t\t}\n \t\t\tLong currentUserZuid = ZohoCRMIAMUtil.getZUIDFromUserId(userId);\n \t\t\tLong bugId=getBugId(caseId);\n \t\t\tString updateMode=\"closebug\";\n@@ -1264,6 +1273,10 @@ public boolean editCommentInBugTracker(DataObject cmtDO,String commentAttachmen\n \t\t\t {\n \t\t\t\t return resultJson.put(\"message\", \"Kindly enable the Bug tracker Integration to Continue\");\n \t\t\t }\n+\t\t\t IntegrationModulePermissionsHandler permissionHandler = new IntegrationModulePermissionsHandler(userId, caseId);\n+\t\t\t if(!permissionHandler.getIsTicketReadable()) {\n+\t\t\t\t throw new AuthorizationException(AuthorizedRequestAPIImpl.NOT_ALLOWED_MESSAGE);\n+\t\t\t }\n \t\t\tRequest requestObj = Support.getAuthorizedRequestAPI(userId).get(caseId);\n \t\t\tif(requestObj==null) {\n \t\t\t\tresultJson.put(\"message\", \"No Content Available\");\n@@ -2051,6 +2064,10 @@ public boolean editCommentInBugTracker(DataObject cmtDO,String commentAttachmen\n \t\t\t{\n \t\t\t\treturn returnJson.put(\"message\",\"Insufficient Previlleges to perform this operation.\");\n \t\t\t}\n+\t\t\tIntegrationModulePermissionsHandler permissionHandler = new IntegrationModulePermissionsHandler(userId, caseId);\n+\t\t\tif(!permissionHandler.getIsTicketUpdatable()) {\n+\t\t\t\tthrow new AuthorizationException(AuthorizedRequestAPIImpl.NOT_ALLOWED_MESSAGE);\n+\t\t\t}\n \t\t\tLong zuid=ZohoCRMIAMUtil.getZUIDFromUserId(userId);\n \t\t\tLong zgId=SecurityUtil.getZGID();\n \t\t\tJSONObject resultJson= delinkBuginProjects(caseId,zuid);\n@@ -2280,6 +2297,10 @@ public boolean editCommentInBugTracker(DataObject cmtDO,String commentAttachmen\n \t\t\t{\n \t\t\t\treturn resultJson.put(\"message\",\"Insufficient Previlleges to perform this operation.\");\n \t\t\t}\n+\t\t\tIntegrationModulePermissionsHandler permissionHandler = new IntegrationModulePermissionsHandler(userId, caseId);\n+\t\t\tif(!permissionHandler.getIsTicketUpdatable()) {\n+\t\t\t\tthrow new AuthorizationException(AuthorizedRequestAPIImpl.NOT_ALLOWED_MESSAGE);\n+\t\t\t}\n \t\t\tLong bugId=getProjectsBugIdForCaseId(caseId);\n \t\t\tif(bugId!=null){\n \t\t\t\treturn resultJson.put(\"message\",\"Bug Already Filed\");\n"
87
+ },
88
+ {
89
+ "old_path": "source/com/zoho/support/core/fields/miscellaneous/MiscellaneousField.java",
90
+ "new_path": "source/com/zoho/support/core/fields/miscellaneous/MiscellaneousField.java",
91
+ "a_mode": "100644",
92
+ "b_mode": "100644",
93
+ "new_file": false,
94
+ "renamed_file": false,
95
+ "deleted_file": false,
96
+ "diff": "@@ -22,7 +22,6 @@ import com.zoho.support.restapi.RestAPIConstants;\n @NeededFlag(name=\"autonumber\",fieldType=FieldType.AUTONUMBER)\n @NeededFlag(name=\"expression\",fieldType=FieldType.EXPRESSION)\n @NeededFlag(name=\"multiLookUp\",fieldType=FieldType.MULTI_LOOKUP)\n-@JsonFilter(\"MiscellaneousFieldFilter\")\n public class MiscellaneousField extends AbstractField {\n \t\n \tprivate AutonumberProps autonumber;\n"
97
+ }
98
+ ],
99
+ "compare_timeout": false,
100
+ "compare_same_ref": false
101
+ }
package/main.js ADDED
@@ -0,0 +1,52 @@
1
+ const path = require('path');
2
+ function filterDiffJson(diffJson) {
3
+ let matches = [];
4
+ // console.log(diffJson);
5
+ diffJson?.diffs?.forEach(diffCode => {
6
+ const diffMatch = [];
7
+ const regex = /@@(.*?)@@/g;
8
+ let match;
9
+ while ((match = regex.exec(diffCode.diff)) !== null) {
10
+ diffMatch.push(numParse(match[1]));
11
+ }
12
+ matches.push({
13
+ pathFile: diffCode.new_path,
14
+ diff: diffMatch
15
+ });
16
+ });
17
+ return matches;
18
+ }
19
+
20
+ function numParse(numberParse) {
21
+ var resultedNum = [];
22
+ numberParse
23
+ .split(' ')
24
+ .join(',')
25
+ .split(',')
26
+ .filter(element => {
27
+ if (element.startsWith('-')) {
28
+ resultedNum.push(element.replace('-', ' ').trim());
29
+ // return element.replace('-', ' ').trim();
30
+ return true;
31
+ }
32
+
33
+ if (element.startsWith('+')) {
34
+ resultedNum.push(element.replace('+', ' ').trim());
35
+ return true;
36
+ }
37
+ return false;
38
+ });
39
+ return resultedNum;
40
+ }
41
+
42
+ function getDiffFiles(diffJson) {
43
+ return diffJson?.diffs.map(diff => {
44
+ return diff?.new_path;
45
+ });
46
+ }
47
+
48
+ console.log(
49
+ getDiffFiles(
50
+ require(path.resolve(process.cwd(), 'lintjson.json'), 'utf-8')
51
+ ).join(' ')
52
+ );
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-stb-bdd-vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo",
3
+ "version": "0.1.8-eslint-3",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -2358,6 +2358,11 @@
2358
2358
  "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz",
2359
2359
  "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA=="
2360
2360
  },
2361
+ "adm-zip": {
2362
+ "version": "0.5.10",
2363
+ "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz",
2364
+ "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ=="
2365
+ },
2361
2366
  "agent-base": {
2362
2367
  "version": "6.0.2",
2363
2368
  "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -2813,6 +2818,11 @@
2813
2818
  "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
2814
2819
  "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
2815
2820
  },
2821
+ "color-support": {
2822
+ "version": "1.1.3",
2823
+ "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
2824
+ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg=="
2825
+ },
2816
2826
  "combined-stream": {
2817
2827
  "version": "1.0.8",
2818
2828
  "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -3232,6 +3242,14 @@
3232
3242
  }
3233
3243
  }
3234
3244
  },
3245
+ "fancy-log": {
3246
+ "version": "2.0.0",
3247
+ "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-2.0.0.tgz",
3248
+ "integrity": "sha512-9CzxZbACXMUXW13tS0tI8XsGGmxWzO2DmYrGuBJOJ8k8q2K7hwfJA5qHjuPPe8wtsco33YR9wc+Rlr5wYFvhSA==",
3249
+ "requires": {
3250
+ "color-support": "^1.1.3"
3251
+ }
3252
+ },
3235
3253
  "fast-glob": {
3236
3254
  "version": "3.3.1",
3237
3255
  "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
@@ -4482,6 +4500,14 @@
4482
4500
  }
4483
4501
  }
4484
4502
  },
4503
+ "jest-sonar-reporter": {
4504
+ "version": "2.0.0",
4505
+ "resolved": "https://registry.npmjs.org/jest-sonar-reporter/-/jest-sonar-reporter-2.0.0.tgz",
4506
+ "integrity": "sha512-ZervDCgEX5gdUbdtWsjdipLN3bKJwpxbvhkYNXTAYvAckCihobSLr9OT/IuyNIRT1EZMDDwR6DroWtrq+IL64w==",
4507
+ "requires": {
4508
+ "xml": "^1.0.1"
4509
+ }
4510
+ },
4485
4511
  "jest-util": {
4486
4512
  "version": "29.7.0",
4487
4513
  "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
@@ -4753,6 +4779,11 @@
4753
4779
  "brace-expansion": "^1.1.7"
4754
4780
  }
4755
4781
  },
4782
+ "mkdirp": {
4783
+ "version": "3.0.1",
4784
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
4785
+ "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg=="
4786
+ },
4756
4787
  "ms": {
4757
4788
  "version": "2.1.2",
4758
4789
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -4818,6 +4849,11 @@
4818
4849
  "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
4819
4850
  "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
4820
4851
  },
4852
+ "node-downloader-helper": {
4853
+ "version": "2.1.9",
4854
+ "resolved": "https://registry.npmjs.org/node-downloader-helper/-/node-downloader-helper-2.1.9.tgz",
4855
+ "integrity": "sha512-FSvAol2Z8UP191sZtsUZwHIN0eGoGue3uEXGdWIH5228e9KH1YHXT7fN8Oa33UGf+FbqGTQg3sJfrRGzmVCaJA=="
4856
+ },
4821
4857
  "node-environment-flags": {
4822
4858
  "version": "1.0.6",
4823
4859
  "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz",
@@ -5094,6 +5130,11 @@
5094
5130
  }
5095
5131
  }
5096
5132
  },
5133
+ "progress": {
5134
+ "version": "2.0.3",
5135
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
5136
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
5137
+ },
5097
5138
  "prompts": {
5098
5139
  "version": "2.4.2",
5099
5140
  "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
@@ -5417,6 +5458,11 @@
5417
5458
  "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
5418
5459
  "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
5419
5460
  },
5461
+ "shell-quote": {
5462
+ "version": "1.8.1",
5463
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
5464
+ "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA=="
5465
+ },
5420
5466
  "side-channel": {
5421
5467
  "version": "1.0.4",
5422
5468
  "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -5443,6 +5489,46 @@
5443
5489
  "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
5444
5490
  "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
5445
5491
  },
5492
+ "slugify": {
5493
+ "version": "1.6.6",
5494
+ "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz",
5495
+ "integrity": "sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw=="
5496
+ },
5497
+ "sonarqube-scanner": {
5498
+ "version": "3.3.0",
5499
+ "resolved": "https://registry.npmjs.org/sonarqube-scanner/-/sonarqube-scanner-3.3.0.tgz",
5500
+ "integrity": "sha512-G1A6nXT3GwoK5eRwHfFrR/7ThiDfaRefWPIFQ+ifwFOQ/V9OwziLpZBdWZgmZp21kBRnzAMvjcTzgZMqGBXQKA==",
5501
+ "requires": {
5502
+ "adm-zip": "^0.5.10",
5503
+ "fancy-log": "^2.0.0",
5504
+ "https-proxy-agent": "^7.0.1",
5505
+ "jest-sonar-reporter": "^2.0.0",
5506
+ "mkdirp": "^3.0.1",
5507
+ "node-downloader-helper": "^2.1.9",
5508
+ "progress": "^2.0.3",
5509
+ "shell-quote": "^1.8.1",
5510
+ "slugify": "^1.6.6"
5511
+ },
5512
+ "dependencies": {
5513
+ "agent-base": {
5514
+ "version": "7.1.0",
5515
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz",
5516
+ "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==",
5517
+ "requires": {
5518
+ "debug": "^4.3.4"
5519
+ }
5520
+ },
5521
+ "https-proxy-agent": {
5522
+ "version": "7.0.3",
5523
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.3.tgz",
5524
+ "integrity": "sha512-kCnwztfX0KZJSLOBrcL0emLeFako55NWMovvyPP2AjsghNk9RB1yjSI+jVumPHYZsNXegNoqupSW9IY3afSH8w==",
5525
+ "requires": {
5526
+ "agent-base": "^7.0.2",
5527
+ "debug": "4"
5528
+ }
5529
+ }
5530
+ }
5531
+ },
5446
5532
  "source-map": {
5447
5533
  "version": "0.6.1",
5448
5534
  "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@@ -5946,6 +6032,11 @@
5946
6032
  "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
5947
6033
  "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g=="
5948
6034
  },
6035
+ "xml": {
6036
+ "version": "1.0.1",
6037
+ "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
6038
+ "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw=="
6039
+ },
5949
6040
  "xml-name-validator": {
5950
6041
  "version": "4.0.0",
5951
6042
  "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-eslint-3",
3
+ "version": "0.1.8-eslint-6",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -33,7 +33,8 @@
33
33
  "fast-glob": "3.3.1",
34
34
  "jest": "29.6.2",
35
35
  "jest-environment-jsdom": "29.6.2",
36
- "msw": "1.2.3"
36
+ "msw": "1.2.3",
37
+ "sonarqube-scanner": "^3.3.0"
37
38
  },
38
39
  "bin": {
39
40
  "ZDTestingFramework": "./bin/cli.js"
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.runEslintForDiff = runEslintForDiff;
8
- var _getFilePath = require("../utils/getFilePath");
9
- var _child_process = require("child_process");
10
- var _path = _interopRequireDefault(require("path"));
11
- var _logger = require("../utils/logger");
12
- function gitDiffFiles() {
13
- const childProcess = (0, _child_process.spawnSync)('git', ['diff', 'HEAD', 'HEAD~1', '--name-only']);
14
- const diff_Files = childProcess.stdout.toString().split('\n').filter(Boolean);
15
- var actualDiff_Files = diff_Files.map(filePath => {
16
- var fileName = _path.default.basename(filePath);
17
- if (filePath.includes('/page-object-model/') || filePath.includes('/assertions/')) {
18
- return _path.default.resolve(process.cwd(), '../', '../', filePath);
19
- }
20
- if (fileName.includes('.spec.js')) {
21
- return _path.default.resolve(process.cwd(), '../', '../', filePath);
22
- }
23
- return false;
24
- });
25
- return actualDiff_Files;
26
- }
27
- function runEslintForDiff() {
28
- // $(git diff --name-only HEAD HEAD~1 | grep -E '\.(js|jsx)$' | xargs)
29
- const format = 'json';
30
- const reportPath = _path.default.resolve(process.cwd(), 'uat', 'eslint-report', 'lintReport.json');
31
- return new Promise(resolve => {
32
- (0, _child_process.exec)(`npx eslint ${getLintFiles()} --format=${format} -o ${reportPath}`, (stdout, stderr) => {
33
- _logger.Logger.log(_logger.Logger.FAILURE_TYPE, stderr);
34
- resolve(stdout);
35
- });
36
- });
37
- }
38
- function getLintFiles() {
39
- var _gitDiffFiles;
40
- return ((_gitDiffFiles = gitDiffFiles()) === null || _gitDiffFiles === void 0 ? void 0 : _gitDiffFiles.join(' ')) || _path.default.resolve(process.cwd(), 'uat', 'modules');
41
- }