Skip to content

Commit

Permalink
Иерархия с папками в отчёте и фикс gotwarlost/istanbul#819
Browse files Browse the repository at this point in the history
  • Loading branch information
ua.knyazev committed Jan 28, 2020
1 parent bc84c31 commit 71616ba
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/report/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function annotateStatements(fileCoverage, structuredText) {
closeSpan = lt + '/span' + gt,
text;

if (type === 'no') {
if (type === 'no' && structuredText[startLine]) {
if (endLine !== startLine) {
endLine = startLine;
endCol = structuredText[startLine].text.originalLength();
Expand Down Expand Up @@ -233,7 +233,7 @@ function annotateFunctions(fileCoverage, structuredText) {
closeSpan = lt + '/span' + gt,
text;

if (type === 'no') {
if (type === 'no' && structuredText[startLine]) {
if (endLine !== startLine) {
endLine = startLine;
endCol = structuredText[startLine].text.originalLength();
Expand Down Expand Up @@ -280,7 +280,7 @@ function annotateBranches(fileCoverage, structuredText) {
openSpan = lt + 'span class="branch-' + i + ' ' + (meta.skip ? 'cbranch-skip' : 'cbranch-no') + '"' + title('branch not covered') + gt;
closeSpan = lt + '/span' + gt;

if (count === 0) { //skip branches taken
if (count === 0 && structuredText[startLine]) { //skip branches taken
if (endLine !== startLine) {
endLine = startLine;
endCol = structuredText[startLine].text.originalLength();
Expand Down Expand Up @@ -451,7 +451,10 @@ Report.mix(HtmlReport, {
this.fillTemplate(node, templateData);
writer.write(headerTemplate(templateData));
writer.write(summaryTableHeader);
children.forEach(function (child) {
children.filter(function (child) {
var isParent = child.fullName.replace(node.fullName, '').split(fs.sep).length;
return isParent === 1 || isParent === 2;
}).forEach(function (child) {
var metrics = child.metrics,
reportClasses = {
statements: getReportClass(metrics.statements, watermarks.statements),
Expand Down

0 comments on commit 71616ba

Please sign in to comment.