added ability to link to a line number in the coverage report

This commit is contained in:
Spencer Alger 2014-03-06 15:51:08 -07:00
parent 5daac03c19
commit 67233f993a
3 changed files with 49 additions and 37 deletions

View file

@ -44,19 +44,20 @@
th Source
tbody
for line, number in file.source
- id = file.filename + ':' + number;
if line.coverage > 0
tr.hit
td.line= number
tr.hit(id=id)
td.line: a(href='#' + id)= number
td.hits= line.coverage
td.source= line.source
else if 0 === line.coverage
tr.miss
td.line= number
tr.miss(id=id)
td.line: a(href='#' + id)= number
td.hits 0
td.source= line.source
else
tr
td.line= number
tr(id=id)
td.line: a(href='#' + id)= number
td.hits
td.source= line.source || ' '
@ -367,8 +368,11 @@ style.
width: 20px;
background: #eaeaea;
text-align: center;
font-size: 11px;
padding: 0 10px;
font-size: 11px;
}
table td.line a {
color: #949494;
}

File diff suppressed because one or more lines are too long

View file

@ -33,6 +33,8 @@ define(function (require) {
var covGrepQueryParamRE = /cov_grep=([^&]+)/;
var afterDraw = window.requestAnimationFrame || function (cb) { setTimeout(cb, 500); };
function IstanbulReporter(runner) {
// "inherit" the base reporters characteristics
Base.call(this, runner);
@ -80,11 +82,9 @@ define(function (require) {
linkNav();
if (gotoFile) {
var header = document.getElementById(gotoFile.substring(1));
if (header) {
afterDraw(function () {
window.location.hash = gotoFile;
document.body.scrollTop = header.offsetTop;
}
});
}
});
}