Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ETtestim committed Jul 8, 2024
1 parent 6a891db commit c9219d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/junitParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ async function parseFile(file: string, projectTokenDictionaryStrs: string[]) {
const data: string = fs.readFileSync(file, 'utf8');
const parser = new XMLParser({ allowBooleanAttributes: true, ignoreAttributes: false, attributeNamePrefix: '' });
const report = parser.parse(data) as Partial<JUnitReport>;
const testsuites = castArray(report?.testsuite || report.testsuites?.testsuite);
return Promise.all(testsuites.map(async testsuite => parseSuite(file, projectTokenDictionaryStrs, testsuite)));
const testsuites = castArray(report?.testsuite || report?.testsuites?.testsuite);
return Promise.all(testsuites.map(async (testsuite: JUnitSuite | undefined) => parseSuite(file, projectTokenDictionaryStrs, testsuite)));
}

async function parseSuite(fileName: string, projectTokenDictionaryStrs: string[], testsuite?: JUnitSuite) {
Expand Down Expand Up @@ -128,7 +128,7 @@ export async function parseTestReports(checkName: string, summary: string, repor
if (totalCount === 0) {
continue;
}
const failed = annotations.filter(an => an.annotation_level !== 'notice').length;
const failed = annotations.filter((an: { annotation_level: string; }) => an.annotation_level !== 'notice').length;
const passed = totalCount - failed - skipped;
testResults.push({
summary,
Expand All @@ -147,7 +147,7 @@ export async function parseTestReports(checkName: string, summary: string, repor
return testResults;
}

class NoTestsFoundError extends Error { }
class NoTestsFoundError extends Error {}

export async function getTestReports(inputs: Readonly<ReturnType<typeof parseInputs>>) {
core.startGroup(`📦 Process test results`);
Expand All @@ -156,7 +156,7 @@ export async function getTestReports(inputs: Readonly<ReturnType<typeof parseInp
core.info(`Retrieved ${reportsCount} report globs/files to process.`);

const allResults = await Promise.all(
inputs.reportPaths.map(async (_, i) =>
inputs.reportPaths.map(async (_: any, i: any) =>
parseTestReports(
retrieve('checkName', inputs.checkName, i, reportsCount),
retrieve('summary', inputs.summary, i, reportsCount),
Expand Down

0 comments on commit c9219d7

Please sign in to comment.