@zohodesk/testinglibrary 0.1.8-eslint-17 → 0.1.8-eslint-18

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.
@@ -100,7 +100,7 @@ function filterDiffJson(diffJson) {
100
100
  return diffFilesMap;
101
101
  }
102
102
  function getRootDir() {
103
- return _path.default.resolve(process.cwd());
103
+ return process.cwd();
104
104
  }
105
105
  function getPathFromTestDir(diffPath) {
106
106
  if (!diffPath.includes('uat')) {
@@ -142,11 +142,13 @@ function getDiffJsonPath(diffJsonPath) {
142
142
  return _path.default.resolve(diffJsonPath);
143
143
  }
144
144
  function gitDiffFiles() {
145
- const command = 'git diff HEAD HEAD~1 --name-only';
145
+ const command = 'git diff --cached -U0 HEAD';
146
146
  const child = (0, _child_process.spawnSync)(command, {
147
147
  shell: true
148
148
  });
149
- return child.stdout.toString().split('\n').map(filePath => _path.default.resolve(getRootLintPath(), filePath));
149
+ const diffFiles = child.stdout.toString().split('\n').map(filePath => _path.default.resolve(getRootLintPath(), filePath));
150
+ diffFiles.pop(); // remove last empty string
151
+ return diffFiles;
150
152
  }
151
153
  function getRootLintPath() {
152
154
  const childProcess = (0, _child_process.spawnSync)('git', ['rev-parse', '--show-toplevel'], {
@@ -48,10 +48,9 @@ function runSonarAnalysis(cliParams) {
48
48
  if (lintEnv == 'pre-commit') {
49
49
  resultFilesPath = (0, _eslintLintStage.gitDiffFiles)().join(',');
50
50
  }
51
- const command = ['-jar', sonar_scanner_path, `-Dsonar.host.url=${sonarqube_host_url}`, `-Dsonar.projectKey=${project_name}`, `-Dsonar.login=${Dlogin}`, `-Dsonar.password=${Dpassword}`, `-Dsonar.sources=${source_directories_str}`, `-Dsonar.tests=${resultFilesPath}`, '-Dsonar.language=js', `-Dsonar.eslint.reportPaths=${(0, _eslintLintStage.getReportPath)()}`, '-Dsonar.javascript.lcov.reportPaths=coverage/lcov-report/lcov.info'];
51
+ const command = ['-jar', sonar_scanner_path, `-Dsonar.host.url=${sonarqube_host_url}`, `-Dsonar.projectKey=${project_name}`, `-Dsonar.login=${Dlogin}`, `-Dsonar.password=${Dpassword}`, `-Dsonar.sources=${source_directories_str}`, `-Dsonar.tests=${resultFilesPath}`, '-Dsonar.language=js', `-Dsonar.working.directory=${getSonarArtifactsDir()}`, `-Dsonar.eslint.reportPaths=${(0, _eslintLintStage.getReportPath)()}`, '-Dsonar.javascript.lcov.reportPaths=coverage/lcov-report/lcov.info'];
52
52
  const child_process = (0, _child_process.spawn)('java', command);
53
53
  child_process.stdout.on('data', data => {
54
- _logger.Logger.log(_logger.Logger.INFO_TYPE, 'sending report to server ...');
55
54
  _logger.Logger.log(_logger.Logger.SUCCESS_TYPE, data);
56
55
  });
57
56
  child_process.stderr.on('data', errorOut => {
@@ -96,7 +95,7 @@ function getBranchName() {
96
95
  return branchName;
97
96
  }
98
97
  function getSpwanOutput(command, params = []) {
99
- const demon_process = (0, _child_process.spawnSync)(command, {
98
+ const demon_process = (0, _child_process.spawnSync)(command, params, {
100
99
  shell: true
101
100
  });
102
101
  return demon_process.stdout.toString().split('\n').filter(Boolean);
@@ -113,6 +112,9 @@ function getCredentials(login, password) {
113
112
  Dpassword: 'developer'
114
113
  };
115
114
  }
115
+ function getSonarArtifactsDir() {
116
+ return _path.default.resolve(process.cwd(), 'uat', 'lint-report', '.scannerwork');
117
+ }
116
118
 
117
119
  // import scanner from 'sonarqube-scanner';
118
120
  // import { generateConfigFromFile } from '../core/playwright/readConfigFile';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.1.8-eslint-17",
3
+ "version": "0.1.8-eslint-18",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {