Skip to content

Commit

Permalink
report failing 'pending tests' as failed
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Nov 22, 2019
1 parent b9fbd69 commit 4869ccf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,10 @@ Runner.prototype.uncaught = function(err) {
if (err instanceof Pending) {
return;
}
if (this.allowUncaught) {
throw err;
}

if (err) {
debug('uncaught exception %O', err);
} else {
Expand Down Expand Up @@ -829,11 +833,17 @@ Runner.prototype.uncaught = function(err) {

runnable.clearTimeout();

// Ignore errors if already failed or pending
// See #3226
if (runnable.isFailed() || runnable.isPending()) {
if (runnable.isFailed()) {
// Ignore error if already failed
return;
} else if (runnable.isPending()) {
// report 'pending test' retrospectively as failed
runnable.isPending = alwaysFalse;
this.fail(runnable, err);
delete runnable.isPending;
return;
}

// we cannot recover gracefully if a Runnable has already passed
// then fails asynchronously
var alreadyPassed = runnable.isPassed();
Expand Down

0 comments on commit 4869ccf

Please sign in to comment.