@zohodesk/testinglibrary 0.1.8-eslint-4 → 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
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-eslint-4",
3
+ "version": "0.1.8-eslint-6",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -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
- }