From 20dc7a309f1fb740f9fc35aa9d8c27e2365e6c79 Mon Sep 17 00:00:00 2001 From: Stepan Riha Date: Thu, 5 Apr 2012 04:57:01 -0500 Subject: [PATCH] Added suite.parent null check. Fixed spelling. #270 --- lib/reporters/html.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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));