diff --git a/lib/report/html.js b/lib/report/html.js index 1dab26d..2ea1f6c 100644 --- a/lib/report/html.js +++ b/lib/report/html.js @@ -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(); @@ -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(); @@ -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(); @@ -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),