Skip to content

Commit

Permalink
Added suite.parent null check. Fixed spelling. mochajs#270
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepan Riha committed Apr 5, 2012
1 parent 74d19a9 commit 20dc7a3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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(' '));
}
Expand Down Expand Up @@ -239,15 +239,14 @@ function HTML(runner) {
el.appendChild(fragment('<pre class="error">%e</pre>', 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('<span class="%s">•</span>', state));
Expand Down

0 comments on commit 20dc7a3

Please sign in to comment.