Skip to content

Commit

Permalink
abort failing 'pending tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Oct 26, 2019
1 parent f73e7c6 commit f478638
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,15 @@ Runner.prototype.runSuite = function(suite, fn) {
* @private
*/
Runner.prototype.uncaught = function(err) {
// ignore async 'this.skip()' exception
if (err instanceof Pending) {
return;
}
// allow uncaught exceptions to propagate
if (this.allowUncaught) {
throw err;
}

if (err) {
debug('uncaught exception %O', err);
} else {
Expand Down Expand Up @@ -829,11 +835,18 @@ 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()) {
// we can't recover from a failing 'pending test'
runnable.isPending = alwaysFalse;
this.fail(runnable, err);
delete runnable.isPending;
this.abort();
return;
}

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

0 comments on commit f478638

Please sign in to comment.