Skip to content

Commit

Permalink
fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
santoshshinde2012 committed May 16, 2024
1 parent dd556da commit 822fa3a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
58 changes: 29 additions & 29 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
TN:
SF:src/helpers/utils.ts
FN:5,generateXML
FN:37,getRelativePath
FN:43,createFile
FN:38,getRelativePath
FN:44,createFile
FNF:3
FNH:3
FNDA:4,generateXML
Expand All @@ -17,26 +17,26 @@ DA:11,3
DA:12,7
DA:13,7
DA:15,7
DA:17,7
DA:18,1
DA:19,6
DA:20,2
DA:21,4
DA:22,1
DA:25,7
DA:28,3
DA:31,4
DA:19,7
DA:20,1
DA:21,6
DA:22,2
DA:23,4
DA:24,1
DA:27,7
DA:30,3
DA:33,4
DA:38,5
DA:35,4
DA:39,5
DA:40,5
DA:44,5
DA:47,5
DA:48,4
DA:51,5
DA:41,5
DA:45,5
DA:48,5
DA:49,4
DA:52,5
DA:54,1
DA:58,2
DA:53,5
DA:55,1
DA:59,2
LF:29
LH:29
BRDA:13,0,0,1
Expand All @@ -47,17 +47,17 @@ BRDA:13,2,0,6
BRDA:13,2,1,1
BRDA:13,3,0,7
BRDA:13,3,1,7
BRDA:15,4,0,3
BRDA:15,4,1,4
BRDA:17,5,0,1
BRDA:17,5,1,6
BRDA:17,6,0,7
BRDA:17,6,1,6
BRDA:19,7,0,2
BRDA:19,7,1,4
BRDA:21,8,0,1
BRDA:25,9,0,4
BRDA:47,10,0,4
BRDA:16,4,0,3
BRDA:16,4,1,4
BRDA:19,5,0,1
BRDA:19,5,1,6
BRDA:19,6,0,7
BRDA:19,6,1,6
BRDA:21,7,0,2
BRDA:21,7,1,4
BRDA:23,8,0,1
BRDA:27,9,0,4
BRDA:48,10,0,4
BRF:19
BRH:19
end_of_record
Expand Down
10 changes: 5 additions & 5 deletions coverage/sonar-report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
<testCase name="generateXML generates correct XML with test cases of 0 duration" duration="1" />
<testCase name="generateXML handles empty testFileResults map" duration="0" />
<testCase name="generateXML handles empty path" duration="0" />
<testCase name="getRelativePath generates relative path correctly" duration="1" />
<testCase name="getRelativePath generates relative path correctly" duration="0" />
<testCase name="getRelativePath handles 'process.cwd()' in path" duration="0" />
<testCase name="getRelativePath handles empty input string" duration="0" />
<testCase name="getRelativePath handles empty basePath" duration="1" />
<testCase name="getRelativePath handles empty basePath" duration="0" />
</file>
<file path="tests/lib/SonarReporter.spec.ts">
<testCase name="SonarReporter onTestResult should add test results to testFileResults" duration="1" />
<testCase name="SonarReporter onRunComplete should write XML file with test results" duration="0" />
<testCase name="SonarReporter onTestResult should add test results to testFileResults" duration="0" />
<testCase name="SonarReporter onRunComplete should write XML file with test results" duration="1" />
<testCase name="SonarReporter onRunComplete should use default output file if not provided - skipped" duration="0">
<skipped message="SonarReporter onRunComplete should use default output file if not provided - skipped" />
</testCase>
<testCase name="SonarReporter onRunComplete should use default output file if not provided" duration="1" />
<testCase name="SonarReporter onRunComplete should use default output file if not provided" duration="0" />
<testCase name="SonarReporter onRunComplete should use provided output file" duration="0" />
</file>
</testExecutions>
5 changes: 3 additions & 2 deletions src/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ function generateXML(testFileResults: Map<string, ITestCase[]>): string {
const testName = test.name.replace(/"/g, "'");
const failureMessage = test.failureMessages?.toString() ?? 'Error';

lines.push(` <testCase name="${testName}" duration="${test.duration}"${test.status === 'passed' ? ' /' : ''}>`);
lines.push(
` <testCase name="${testName}" duration="${test.duration}"${test.status === 'passed' ? ' /' : ''}>`,
);

if (test.status === 'skipped' || test.status === 'pending') {
lines.push(` <skipped message="${testName}" />`);
Expand All @@ -33,7 +35,6 @@ function generateXML(testFileResults: Map<string, ITestCase[]>): string {
return lines.join('\n');
}


function getRelativePath(fullPath: string): string {
const basePath = process.cwd();
const relativePath = fullPath.replace(`${basePath}/`, '');
Expand Down

0 comments on commit 822fa3a

Please sign in to comment.