@zohodesk/testinglibrary 0.1.8-eslint-21 → 0.1.8-eslint-24
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.
|
@@ -50,7 +50,7 @@ async function runEslintForDiff(cliParams, options = {}) {
|
|
|
50
50
|
});
|
|
51
51
|
lint_process.on('close', async onclose => {
|
|
52
52
|
if (diffPath && !(filteredDiffFiles.length === 0)) {
|
|
53
|
-
const filteredJson = await
|
|
53
|
+
const filteredJson = await filterReportBasedDiff(require(reportPath), diffJSON);
|
|
54
54
|
(0, _fileUtils.writeFileContents)(reportPath, JSON.stringify(filteredJson));
|
|
55
55
|
}
|
|
56
56
|
resolve({
|
|
@@ -63,29 +63,28 @@ async function runEslintForDiff(cliParams, options = {}) {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function filterReportBasedDiff(resultJson, diffJson) {
|
|
67
67
|
return new Promise(resolve => {
|
|
68
68
|
if (!diffJson) {
|
|
69
69
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'git diff json is not given ...');
|
|
70
70
|
resolve(false);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const impactLineMap = filterDiffJson(diffJson);
|
|
73
73
|
resultJson = resultJson.filter(result => {
|
|
74
|
-
var
|
|
75
|
-
const isImpactFile =
|
|
74
|
+
var _impactLineMap$get;
|
|
75
|
+
const isImpactFile = result.filePath;
|
|
76
76
|
if (!isImpactFile) {
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
|
-
if (((
|
|
79
|
+
if (((_impactLineMap$get = impactLineMap.get(isImpactFile)) === null || _impactLineMap$get === void 0 ? void 0 : _impactLineMap$get.length) !== 0) {
|
|
80
80
|
result.messages = result.messages.filter(errorMsg => {
|
|
81
|
-
if (
|
|
81
|
+
if (impactLineMap.get(isImpactFile).includes(`${errorMsg.line}`)) {
|
|
82
82
|
return true;
|
|
83
83
|
}
|
|
84
84
|
return false;
|
|
85
85
|
});
|
|
86
86
|
return true;
|
|
87
87
|
}
|
|
88
|
-
return false;
|
|
89
88
|
});
|
|
90
89
|
resolve(resultJson);
|
|
91
90
|
});
|
|
@@ -100,7 +99,7 @@ function filterDiffJson(diffJson) {
|
|
|
100
99
|
while ((match = regex.exec(diff.diff)) !== null) {
|
|
101
100
|
diffMatch.push(...splitFilterNumber(match[1]));
|
|
102
101
|
}
|
|
103
|
-
const diffPathKey =
|
|
102
|
+
const diffPathKey = _path.default.resolve(getRootLintPath(), diff.new_path);
|
|
104
103
|
if (diffPathKey === undefined) {
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
@@ -64,7 +64,7 @@ function runSonarAnalysis(cliParams) {
|
|
|
64
64
|
_logger.Logger.error(_logger.Logger.FAILURE_TYPE, `Error: ${error.message}`);
|
|
65
65
|
});
|
|
66
66
|
child_process.on('close', code => {
|
|
67
|
-
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, `
|
|
67
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, `Report to Server Status - ${code === 0 ? 'Success' : 'Failure'}`);
|
|
68
68
|
(0, _sonarReportSummary.writeSummaryOfLint)(cliParams);
|
|
69
69
|
_logger.Logger.log(_logger.Logger.INFO_TYPE, `report url - ${(0, _sonarReportSummary.getSummaryOfLint)(cliParams).reportUrl}`);
|
|
70
70
|
if (lintEnv == 'pre-commit') {
|
|
@@ -72,15 +72,10 @@ function runSonarAnalysis(cliParams) {
|
|
|
72
72
|
if (!getLintStatus().status && getLintStatus().message == 'failed') {
|
|
73
73
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'rules violated .. ');
|
|
74
74
|
(0, _popUpCli.showMsgPopUp)('IssueFound');
|
|
75
|
-
process.exit(
|
|
75
|
+
process.exit(1);
|
|
76
76
|
} else {
|
|
77
77
|
(0, _popUpCli.showMsgPopUp)('NoIssueFound');
|
|
78
78
|
}
|
|
79
|
-
if (!getLintStatus().status && getLintStatus().message == 'failed') {
|
|
80
|
-
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'rules violated .. ');
|
|
81
|
-
(0, _popUpCli.showMsgPopUp)('IssueFound');
|
|
82
|
-
process.exit(0);
|
|
83
|
-
}
|
|
84
79
|
}
|
|
85
80
|
});
|
|
86
81
|
}
|
|
@@ -97,7 +92,10 @@ function getFilePathFrmReport(resultJson) {
|
|
|
97
92
|
});
|
|
98
93
|
}
|
|
99
94
|
function getProjectNameFrmGit() {
|
|
100
|
-
|
|
95
|
+
let $repoName = getRepoName();
|
|
96
|
+
let $branchName = getBranchName();
|
|
97
|
+
let $username = getGitUsername();
|
|
98
|
+
return $repoName && $branchName && $username ? `${$repoName}_${$branchName}_${$username}` : 'desk_default_project';
|
|
101
99
|
}
|
|
102
100
|
function getGitUsername() {
|
|
103
101
|
const userName = getSpawnOutput('git', ['config', 'user.email']);
|
|
@@ -108,7 +106,7 @@ function getRepoName() {
|
|
|
108
106
|
return repoName.pop().split('/').pop().split('.')[0];
|
|
109
107
|
}
|
|
110
108
|
function getBranchName() {
|
|
111
|
-
const branchName = getSpawnOutput('git', ['branch'])
|
|
109
|
+
const branchName = getSpawnOutput('git', ['branch'])[1]; // to get current branch
|
|
112
110
|
if (branchName.startsWith('*')) {
|
|
113
111
|
return branchName.replace('*', ' ').trim();
|
|
114
112
|
}
|
|
@@ -143,8 +141,8 @@ function getLintStatus() {
|
|
|
143
141
|
};
|
|
144
142
|
}
|
|
145
143
|
if (report.length != 0) {
|
|
146
|
-
for (i = 0; i < report.length; i++) {
|
|
147
|
-
if (
|
|
144
|
+
for (let i = 0; i < report.length; i++) {
|
|
145
|
+
if (report[i].messages != 0) {
|
|
148
146
|
reportStatus = false;
|
|
149
147
|
break;
|
|
150
148
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/testinglibrary",
|
|
3
|
-
"version": "0.1.8",
|
|
3
|
+
"version": "0.1.8-eslint-21",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -2497,6 +2497,12 @@
|
|
|
2497
2497
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz",
|
|
2498
2498
|
"integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA=="
|
|
2499
2499
|
},
|
|
2500
|
+
"adm-zip": {
|
|
2501
|
+
"version": "0.5.12",
|
|
2502
|
+
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.12.tgz",
|
|
2503
|
+
"integrity": "sha512-6TVU49mK6KZb4qG6xWaaM4C7sA/sgUMLy/JYMOzkcp3BvVLpW0fXDFQiIzAuxFCt/2+xD7fNIiPFAoLZPhVNLQ==",
|
|
2504
|
+
"dev": true
|
|
2505
|
+
},
|
|
2500
2506
|
"agent-base": {
|
|
2501
2507
|
"version": "6.0.2",
|
|
2502
2508
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
|
@@ -2991,6 +2997,12 @@
|
|
|
2991
2997
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
2992
2998
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
2993
2999
|
},
|
|
3000
|
+
"color-support": {
|
|
3001
|
+
"version": "1.1.3",
|
|
3002
|
+
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
|
|
3003
|
+
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
|
|
3004
|
+
"dev": true
|
|
3005
|
+
},
|
|
2994
3006
|
"combined-stream": {
|
|
2995
3007
|
"version": "1.0.8",
|
|
2996
3008
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
|
@@ -3433,6 +3445,15 @@
|
|
|
3433
3445
|
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz",
|
|
3434
3446
|
"integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA=="
|
|
3435
3447
|
},
|
|
3448
|
+
"fancy-log": {
|
|
3449
|
+
"version": "2.0.0",
|
|
3450
|
+
"resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-2.0.0.tgz",
|
|
3451
|
+
"integrity": "sha512-9CzxZbACXMUXW13tS0tI8XsGGmxWzO2DmYrGuBJOJ8k8q2K7hwfJA5qHjuPPe8wtsco33YR9wc+Rlr5wYFvhSA==",
|
|
3452
|
+
"dev": true,
|
|
3453
|
+
"requires": {
|
|
3454
|
+
"color-support": "^1.1.3"
|
|
3455
|
+
}
|
|
3456
|
+
},
|
|
3436
3457
|
"fast-glob": {
|
|
3437
3458
|
"version": "3.3.1",
|
|
3438
3459
|
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
|
|
@@ -4725,6 +4746,15 @@
|
|
|
4725
4746
|
}
|
|
4726
4747
|
}
|
|
4727
4748
|
},
|
|
4749
|
+
"jest-sonar-reporter": {
|
|
4750
|
+
"version": "2.0.0",
|
|
4751
|
+
"resolved": "https://registry.npmjs.org/jest-sonar-reporter/-/jest-sonar-reporter-2.0.0.tgz",
|
|
4752
|
+
"integrity": "sha512-ZervDCgEX5gdUbdtWsjdipLN3bKJwpxbvhkYNXTAYvAckCihobSLr9OT/IuyNIRT1EZMDDwR6DroWtrq+IL64w==",
|
|
4753
|
+
"dev": true,
|
|
4754
|
+
"requires": {
|
|
4755
|
+
"xml": "^1.0.1"
|
|
4756
|
+
}
|
|
4757
|
+
},
|
|
4728
4758
|
"jest-util": {
|
|
4729
4759
|
"version": "29.7.0",
|
|
4730
4760
|
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
|
|
@@ -5119,6 +5149,12 @@
|
|
|
5119
5149
|
"tslib": "^2.0.3"
|
|
5120
5150
|
}
|
|
5121
5151
|
},
|
|
5152
|
+
"node-downloader-helper": {
|
|
5153
|
+
"version": "2.1.9",
|
|
5154
|
+
"resolved": "https://registry.npmjs.org/node-downloader-helper/-/node-downloader-helper-2.1.9.tgz",
|
|
5155
|
+
"integrity": "sha512-FSvAol2Z8UP191sZtsUZwHIN0eGoGue3uEXGdWIH5228e9KH1YHXT7fN8Oa33UGf+FbqGTQg3sJfrRGzmVCaJA==",
|
|
5156
|
+
"dev": true
|
|
5157
|
+
},
|
|
5122
5158
|
"node-environment-flags": {
|
|
5123
5159
|
"version": "1.0.6",
|
|
5124
5160
|
"resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz",
|
|
@@ -5797,6 +5833,12 @@
|
|
|
5797
5833
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
|
5798
5834
|
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
|
|
5799
5835
|
},
|
|
5836
|
+
"shell-quote": {
|
|
5837
|
+
"version": "1.8.1",
|
|
5838
|
+
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
|
|
5839
|
+
"integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==",
|
|
5840
|
+
"dev": true
|
|
5841
|
+
},
|
|
5800
5842
|
"side-channel": {
|
|
5801
5843
|
"version": "1.0.4",
|
|
5802
5844
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
|
@@ -5823,6 +5865,56 @@
|
|
|
5823
5865
|
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
|
5824
5866
|
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
|
|
5825
5867
|
},
|
|
5868
|
+
"slugify": {
|
|
5869
|
+
"version": "1.6.6",
|
|
5870
|
+
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz",
|
|
5871
|
+
"integrity": "sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==",
|
|
5872
|
+
"dev": true
|
|
5873
|
+
},
|
|
5874
|
+
"sonarqube-scanner": {
|
|
5875
|
+
"version": "3.3.0",
|
|
5876
|
+
"resolved": "https://registry.npmjs.org/sonarqube-scanner/-/sonarqube-scanner-3.3.0.tgz",
|
|
5877
|
+
"integrity": "sha512-G1A6nXT3GwoK5eRwHfFrR/7ThiDfaRefWPIFQ+ifwFOQ/V9OwziLpZBdWZgmZp21kBRnzAMvjcTzgZMqGBXQKA==",
|
|
5878
|
+
"dev": true,
|
|
5879
|
+
"requires": {
|
|
5880
|
+
"adm-zip": "^0.5.10",
|
|
5881
|
+
"fancy-log": "^2.0.0",
|
|
5882
|
+
"https-proxy-agent": "^7.0.1",
|
|
5883
|
+
"jest-sonar-reporter": "^2.0.0",
|
|
5884
|
+
"mkdirp": "^3.0.1",
|
|
5885
|
+
"node-downloader-helper": "^2.1.9",
|
|
5886
|
+
"progress": "^2.0.3",
|
|
5887
|
+
"shell-quote": "^1.8.1",
|
|
5888
|
+
"slugify": "^1.6.6"
|
|
5889
|
+
},
|
|
5890
|
+
"dependencies": {
|
|
5891
|
+
"agent-base": {
|
|
5892
|
+
"version": "7.1.0",
|
|
5893
|
+
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz",
|
|
5894
|
+
"integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==",
|
|
5895
|
+
"dev": true,
|
|
5896
|
+
"requires": {
|
|
5897
|
+
"debug": "^4.3.4"
|
|
5898
|
+
}
|
|
5899
|
+
},
|
|
5900
|
+
"https-proxy-agent": {
|
|
5901
|
+
"version": "7.0.4",
|
|
5902
|
+
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz",
|
|
5903
|
+
"integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==",
|
|
5904
|
+
"dev": true,
|
|
5905
|
+
"requires": {
|
|
5906
|
+
"agent-base": "^7.0.2",
|
|
5907
|
+
"debug": "4"
|
|
5908
|
+
}
|
|
5909
|
+
},
|
|
5910
|
+
"mkdirp": {
|
|
5911
|
+
"version": "3.0.1",
|
|
5912
|
+
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
|
|
5913
|
+
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
|
|
5914
|
+
"dev": true
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
},
|
|
5826
5918
|
"source-map": {
|
|
5827
5919
|
"version": "0.6.1",
|
|
5828
5920
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
|
@@ -6387,6 +6479,12 @@
|
|
|
6387
6479
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
|
|
6388
6480
|
"integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g=="
|
|
6389
6481
|
},
|
|
6482
|
+
"xml": {
|
|
6483
|
+
"version": "1.0.1",
|
|
6484
|
+
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
|
6485
|
+
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
|
|
6486
|
+
"dev": true
|
|
6487
|
+
},
|
|
6390
6488
|
"xml-name-validator": {
|
|
6391
6489
|
"version": "4.0.0",
|
|
6392
6490
|
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
|