Skip to content

Commit

Permalink
Fixed duplicate reporting for HTML reporter. Closes #154
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 18, 2011
1 parent f50f98a commit 8ab0d5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function HTML(runner) {
});

runner.on('fail', function(test, err){
runner.emit('test end', test);
if (err.uncaught) runner.emit('test end', test);
});

runner.on('test end', function(test){
Expand Down
1 change: 1 addition & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ Runner.prototype.run = function(fn){
var runnable = self.currentRunnable;
debug('uncaught exception');
runnable.clearTimeout();
err.uncaught = true;
self.fail(runnable, err);

// recover from test
Expand Down
3 changes: 2 additions & 1 deletion mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ function HTML(runner) {
});

runner.on('fail', function(test, err){
runner.emit('test end', test);
if (err.uncaught) runner.emit('test end', test);
});

runner.on('test end', function(test){
Expand Down Expand Up @@ -2383,6 +2383,7 @@ Runner.prototype.run = function(fn){
var runnable = self.currentRunnable;
debug('uncaught exception');
runnable.clearTimeout();
err.uncaught = true;
self.fail(runnable, err);

// recover from test
Expand Down
6 changes: 3 additions & 3 deletions test/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
var runner = mocha.run();
runner.globals(['foo', 'bar', 'baz']);

runner.on('test end', function(test){
console.log(test.fullTitle());
});
// runner.on('test end', function(test){
// console.log(test.fullTitle());
// });
};
</script>
</head>
Expand Down

0 comments on commit 8ab0d5b

Please sign in to comment.