diff --git a/lib/reporters/html.js b/lib/reporters/html.js index 2171579f52..00a7556204 100644 --- a/lib/reporters/html.js +++ b/lib/reporters/html.js @@ -124,7 +124,7 @@ function HTML(runner) { } // propagates the test state up its parent suites - function propageTestState(suite, state) { + function propagateTestState(suite, state) { while(suite) { @@ -175,7 +175,7 @@ function HTML(runner) { }); runner.on('suite end', function(suite){ - if(suite.parent.root) { + if(suite.parent && suite.parent.root) { // insert space between top-level suites dots.appendChild(document.createTextNode(' ')); } @@ -239,15 +239,14 @@ function HTML(runner) { el.appendChild(fragment('
%e
', str)); } - if(test.type==='hook') { - // update hook's suite and parents - propageTestState(test.suite, state); - } else { + if(test.type!=='hook') { addFocusLink(el, test); - // update test's parent suites - propageTestState(test.parent, state); } + // update parent suites + propagateTestState(test.parent, state); + + // update our totals tests[state] += 1; dots.appendChild(fragment('', state));