11import { CoverageData } from "../../../getCoverage" ;
22
3- const globalHeaders = [ "Percent" , "Threshold" , "Total" , "Covered" , "Uncovered" ] ;
3+ const reportHeaders = [ "Percent" , "Threshold" , "Total" , "Covered" , "Uncovered" ] ;
44
55const headers = [ "Filename" , "Percent" , "Total" , "Covered" , "Uncovered" ] ;
66
7- type Props = Omit < CoverageData , "anys" > & {
7+ type GenerateSummaryPageContext = Omit < CoverageData , "anys" > & {
88 threshold : number ;
99} ;
1010
@@ -15,39 +15,39 @@ export const generateSummaryPage = ({
1515 covered,
1616 uncovered,
1717 threshold
18- } : Props ) => {
18+ } : GenerateSummaryPageContext ) => {
1919 const isSummaryValid = percentage >= threshold ;
2020
2121 return `
22- <section style="margin-top: 3em;">
23- <h1>TypeScript coverage report</h1>
24- <h2>Summary</h2>
25- <table>
22+ <div style="margin-top: 3em;" class="ui container ">
23+ <h1 class="ui header" >TypeScript coverage report</h1>
24+ <h2 class="ui header" >Summary</h2>
25+ <table class="ui table celled" >
2626 <thead>
2727 <tr>
28- ${ globalHeaders . map ( ( header ) => `<th>${ header } </th>` ) . join ( "\n" ) }
28+ ${ reportHeaders . map ( ( header ) => `<th>${ header } </th>` ) . join ( "\n" ) }
2929 </tr>
3030 </thead>
3131 <tbody>
3232 <tr class="${ isSummaryValid ? "positive" : "negative" } ">
33- <td>${ percentage . toFixed ( 2 ) + "%" } </td>
34- <td>${ threshold } %</td>
35- <td>${ total } </td>
36- <td>${ covered } </td>
37- <td>${ uncovered } </td>
33+ <td data-label="Percent" >${ percentage . toFixed ( 2 ) + "%" } </td>
34+ <td data-label="Threshold" >${ threshold } %</td>
35+ <td data-label="Total" >${ total } </td>
36+ <td data-label="Covered" >${ covered } </td>
37+ <td data-label="Uncovered" >${ uncovered } </td>
3838 </tr>
3939 </tbody>
4040 </table>
41- <h2>Files</h2>
42- <table style="margin-top: 2em; " class="sortable">
41+ <h2 class="ui header" >Files</h2>
42+ <table style="margin-top: 2em" class="ui table celled sortable">
4343 <thead>
4444 <tr>
4545 ${ headers . map ( ( header ) => `<th>${ header } </th>` ) . join ( "\n" ) }
4646 </tr>
4747 </thead>
4848 <tbody>
49- ${ Array . from ( fileCounts ) . map (
50- ( [ filename , { correctCount, totalCount } ] ) => {
49+ ${ Array . from ( fileCounts )
50+ . map ( ( [ filename , { correctCount, totalCount } ] ) => {
5151 const percentage =
5252 totalCount === 0 ? 100 : ( correctCount * 100 ) / totalCount ;
5353 const percentageCoverage = percentage . toFixed ( 2 ) + "%" ;
@@ -62,10 +62,9 @@ export const generateSummaryPage = ({
6262 <td>${ totalCount } </td>
6363 <td>${ correctCount } </td>
6464 <td>${ totalCount - correctCount } </td>
65- </tr>
66- ` ;
67- }
68- ) }
65+ </tr>` ;
66+ } )
67+ . join ( "\n" ) }
6968 </tbody>
7069 </table>
7170</section>` ;
0 commit comments