You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"use strict";var{ReportBase:u}=require("istanbul-lib-report");functionm(s){returns.statements.pct===100&&s.branches.pct===100&&s.functions.pct===100&&s.lines.pct===100}functionh(s){if(s.isSummary())return[];lete=s.getCoverageSummary(!1),t=e.isEmpty()?0:e.lines.pct,r,c=s.getFileCoverage();if(t===100){leti=c.getBranchCoverageByLine();r=Object.entries(i).map(([l,{coverage:a}])=>[l,a===100])}elser=Object.entries(c.getLineCoverage());leto=!0;returnr.reduce((i,[l,a])=>{if(a)o=!0;else{letp=parseInt(l);o?(i.push([p]),o=!1):i[i.length-1][1]=p}returni},[])}varf=["Statements","Branches","Functions","Lines"];module.exports=classextendsu{skipEmpty;skipFull;results={};cw=null;watermarks;constructor(e){super(e),this.skipEmpty=!!e.skipEmpty,this.skipFull=!!e.skipFull,this.watermarks=null}onStart(e,n){if(!process.env.GITHUB_STEP_SUMMARY){console.log("Reporter not being executed in Github Actions environment");return}this.cw=n.writer.writeFile(process.env.GITHUB_STEP_SUMMARY),this.watermarks=n.watermarks,this.cw.println("<h3>Test Coverage</h3>"),this.cw.println("<table><thead><tr>");for(lettof["File",...f,"Uncovered Lines"])this.cw.println(`<th>${t}</th>`);this.cw.println("</tr></thead><tbody>")}onSummary(e){letn=e.getRelativeName()||"All Files",t=e.getCoverageSummary(!1),r=t.isEmpty();this.skipEmpty&&r||this.skipFull&&m(t)||(this.results[n]={statements:r?0:t.statements.pct,branches:r?0:t.branches.pct,functions:r?0:t.functions.pct,lines:r?0:t.lines.pct,uncoveredLines:h(e)})}onDetail(e){returnthis.onSummary(e)}formatter(e,n){if(!this.watermarks)return`<td>${e}%</td>`;let[t,r]=this.watermarks[n];returne<t?`<td><p style="color:red">${e}%</p></td>`:e>r?`<td><p style="color:green">${e}%</p></td>`:`<td><p style="color:yellow">${e}%</p></td>`}onEnd(){if(!this.cw)return;lete=Object.keys(this.results).sort();for(letnofe){lett=this.results[n];if(this.cw.println(`<tr><td><code>${n}</code></td>`),this.cw.println(this.formatter(t.statements,"statements")),this.cw.println(this.formatter(t.branches,"branches")),this.cw.println(this.formatter(t.functions,"functions")),this.cw.println(this.formatter(t.lines,"lines")),t.uncoveredLines.length>0){this.cw.println("<td><details><summary>Expand</summary><ul>");for(letroft.uncoveredLines)r.length===1?this.cw.println(`<li>${r[0]}</li>`):this.cw.println(`<li>${r[0]}-${r[1]}</li>`);this.cw.println("</ul></details></td>")}elsethis.cw.println("<td></td>");this.cw.println("</tr>")}this.cw.println("</tbody></table>"),this.cw.close()}};
1
+
"use strict";varm=require("fs"),{ReportBase:p}=require("istanbul-lib-report");functionh(s){returns.statements.pct===100&&s.branches.pct===100&&s.functions.pct===100&&s.lines.pct===100}functionf(s){if(s.isSummary())return[];lete=s.getCoverageSummary(!1),t=e.isEmpty()?0:e.lines.pct,r,c=s.getFileCoverage();if(t===100){leti=c.getBranchCoverageByLine();r=Object.entries(i).map(([a,{coverage:l}])=>[a,l===100])}elser=Object.entries(c.getLineCoverage());leto=!0;returnr.reduce((i,[a,l])=>{if(l)o=!0;else{letu=parseInt(a);o?(i.push([u]),o=!1):i[i.length-1][1]=u}returni},[])}varw=["Statements","Branches","Functions","Lines"];module.exports=classextendsp{skipEmpty;skipFull;results={};cw=null;watermarks=null;constructor(e){super(e),this.skipEmpty=!!e.skipEmpty,this.skipFull=!!e.skipFull}onStart(e,n){if(!process.env.GITHUB_STEP_SUMMARY){console.log("Reporter not being executed in Github Actions environment");return}this.cw=m.createWriteStream(process.env.GITHUB_STEP_SUMMARY,{encoding:"utf-8",flags:"a"}),this.watermarks=n.watermarks,this.cw.write("<h3>Test Coverage</h3>"),this.cw.write("<table><thead><tr>");for(lettof["File",...w,"Uncovered Lines"])this.cw.write(`<th>${t}</th>`);this.cw.write("</tr></thead><tbody>")}onSummary(e){letn=e.getRelativeName()||"All Files",t=e.getCoverageSummary(!1),r=t.isEmpty();this.skipEmpty&&r||this.skipFull&&h(t)||(this.results[n]={statements:r?0:t.statements.pct,branches:r?0:t.branches.pct,functions:r?0:t.functions.pct,lines:r?0:t.lines.pct,uncoveredLines:f(e)})}onDetail(e){returnthis.onSummary(e)}formatter(e,n){if(!this.watermarks)return`<td>${e}%</td>`;let[t,r]=this.watermarks[n];returne<t?`<td><p style="color:red">${e}%</p></td>`:e>r?`<td><p style="color:green">${e}%</p></td>`:`<td><p style="color:yellow">${e}%</p></td>`}onEnd(){if(!this.cw)return;lete=Object.keys(this.results).sort();for(letnofe){lett=this.results[n];if(this.cw.write(`<tr><td><code>${n}</code></td>`),this.cw.write(this.formatter(t.statements,"statements")),this.cw.write(this.formatter(t.branches,"branches")),this.cw.write(this.formatter(t.functions,"functions")),this.cw.write(this.formatter(t.lines,"lines")),t.uncoveredLines.length>0){this.cw.write("<td><details><summary>Expand</summary><ul>");for(letroft.uncoveredLines)r.length===1?this.cw.write(`<li>${r[0]}</li>`):this.cw.write(`<li>${r[0]}-${r[1]}</li>`);this.cw.write("</ul></details></td>")}elsethis.cw.write("<td></td>");this.cw.write("</tr>")}this.cw.write("</tbody></table>"),this.cw.close()}};
0 commit comments