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";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("<h2>Test Coverage</h2>"),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()}};
1
+
"use strict";varb=Object.create;varo=Object.defineProperty;varg=Object.getOwnPropertyDescriptor;vary=Object.getOwnPropertyNames;varv=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;varS=(t,e)=>{for(varnine)o(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,r)=>{if(e&&typeofe=="object"||typeofe=="function")for(letsofy(e))!k.call(t,s)&&s!==n&&o(t,s,{get:()=>e[s],enumerable:!(r=g(e,s))||r.enumerable});returnt};varf=(t,e,n)=>(n=t!=null?b(v(t)):{},p(e||!t||!t.__esModule?o(n,"default",{value:t,enumerable:!0}):n,t)),E=t=>p(o({},"__esModule",{value:!0}),t);varF={};S(F,{default:()=>a});module.exports=E(F);vard=f(require("fs"),1),w=f(require("istanbul-lib-report"),1);functionR(t){returnt.statements.pct===100&&t.branches.pct===100&&t.functions.pct===100&&t.lines.pct===100}functionL(t){if(t.isSummary())return[];lete=t.getCoverageSummary(!1),r=e.isEmpty()?0:e.lines.pct,s,m=t.getFileCoverage();if(r===100){leti=m.getBranchCoverageByLine();s=Object.entries(i).map(([c,{coverage:u}])=>[c,u===100])}elses=Object.entries(m.getLineCoverage());letl=!0;returns.reduce((i,[c,u])=>{if(u)l=!0;else{leth=parseInt(c);l?(i.push([h]),l=!1):i[i.length-1][1]=h}returni},[])}varC=["Statements","Branches","Functions","Lines"],a=classextendsw.ReportBase{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=d.default.createWriteStream(process.env.GITHUB_STEP_SUMMARY,{encoding:"utf-8",flags:"a"}),this.watermarks=n.watermarks,this.cw.write("<h2>Test Coverage</h2>"),this.cw.write("<table><thead><tr>");for(letrof["File",...C,"Uncovered Lines"])this.cw.write(`<th>${r}</th>`);this.cw.write("</tr></thead><tbody>")}onSummary(e){letn=e.getRelativeName()||"All Files",r=e.getCoverageSummary(!1),s=r.isEmpty();this.skipEmpty&&s||this.skipFull&&R(r)||(this.results[n]={statements:s?0:r.statements.pct,branches:s?0:r.branches.pct,functions:s?0:r.functions.pct,lines:s?0:r.lines.pct,uncoveredLines:L(e)})}onDetail(e){returnthis.onSummary(e)}formatter(e,n){if(!this.watermarks||this.watermarks[n]===void0)return`<td>${e}%</td>`;let[r,s]=this.watermarks[n];returne<r?`<td><p style="color:red">${e}%</p></td>`:e>s?`<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){letr=this.results[n];if(this.cw.write(`<tr><td><code>${n}</code></td>`),this.cw.write(this.formatter(r.statements,"statements")),this.cw.write(this.formatter(r.branches,"branches")),this.cw.write(this.formatter(r.functions,"functions")),this.cw.write(this.formatter(r.lines,"lines")),r.uncoveredLines.length>0){this.cw.write("<td><details><summary>Expand</summary><ul>");for(letsofr.uncoveredLines)s.length===1?this.cw.write(`<li>${s[0]}</li>`):this.cw.write(`<li>${s[0]}-${s[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