Skip to content

Commit

Permalink
Now highlighting exactly the uncovered clauses and whiting out any su…
Browse files Browse the repository at this point in the history
…b clauses that may have been covered
  • Loading branch information
hossenlopp committed Mar 21, 2024
1 parent f4b34e6 commit 9957bb9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/calculation/HTMLBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,23 @@ Handlebars.registerHelper('highlightCoverage', (localId, context) => {
// apply highlighting style to uncovered clauses
Handlebars.registerHelper('highlightUncoverage', (localId, context) => {
const libraryName: string = context.data.root.libraryName;
const clauseResults: ClauseResult[] = context.data.root.clauseResults;

const clauseResult = clauseResults.filter(result => result.libraryName === libraryName && result.localId === localId);
if (clauseResult.length > 0) {
if (
(context.data.root.uncoveredClauses as ClauseResult[]).some(
result => result.libraryName === libraryName && result.localId === localId

Check warning on line 101 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 101 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 101 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 101 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
)
) {
// Mark with red styling if clause is found in uncoverage list
return objToCSS(cqlLogicClauseFalseStyle);
} else if (
(context.data.root.coveredClauses as ClauseResult[]).some(
result => result.libraryName === libraryName && result.localId === localId

Check warning on line 108 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 108 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 108 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 108 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
)
) {
// Mark with white (clear out styling) if the clause is in coverage list
return objToCSS(cqlLogicUncoveredClauseStyle);

Check warning on line 112 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 113 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 113 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 113 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 113 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 113 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
// If this clause has no results then it should not be styled
return '';
});

Expand Down Expand Up @@ -316,7 +327,8 @@ export function generateClauseCoverageHTML<T extends CalculationOptions>(
uncoverageHtmlString += main({
libraryName: a.libraryName,
statementName: a.statementName,
clauseResults: clauseCoverage.uncoveredClauses,
uncoveredClauses: clauseCoverage.uncoveredClauses,
coveredClauses: clauseCoverage.coveredClauses,
...a.annotation[0].s,
highlightUncoverage: true
});

Check warning on line 334 in src/calculation/HTMLBuilder.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
Expand Down

0 comments on commit 9957bb9

Please sign in to comment.