@johanblumenberg/mocha
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -114,3 +114,3 @@ 'use strict'; | ||
this._invert = invert; | ||
this.total = this.grepTotal(this.suite); | ||
this.total = this.grepTotal(this.suite, true); | ||
return this; | ||
@@ -143,3 +143,3 @@ }; | ||
this._bucket = bucket; | ||
this.total = this.grepTotal(this.suite); | ||
this.total = this.grepTotal(this.suite, true); | ||
return this; | ||
@@ -158,3 +158,3 @@ }; | ||
*/ | ||
Runner.prototype.grepTotal = function(suite) { | ||
Runner.prototype.grepTotal = function(suite, includePending) { | ||
var self = this; | ||
@@ -166,3 +166,5 @@ var total = 0; | ||
if (self._match(test.fullTitle())) { | ||
total++; | ||
if (includePending || !test.pending) { | ||
total++; | ||
} | ||
} | ||
@@ -680,3 +682,4 @@ } | ||
var self = this; | ||
var total = this.grepTotal(suite); | ||
var total = this.grepTotal(suite, true); | ||
var totalWithoutPending = this.grepTotal(suite, false); | ||
var afterAllHookCalled = false; | ||
@@ -740,6 +743,11 @@ | ||
self.hook('afterAll', function() { | ||
if (totalWithoutPending > 0) { | ||
self.hook('afterAll', function() { | ||
self.emit('suite end', suite); | ||
fn(errSuite); | ||
}); | ||
} else { | ||
self.emit('suite end', suite); | ||
fn(errSuite); | ||
}); | ||
} | ||
} | ||
@@ -750,8 +758,12 @@ } | ||
this.hook('beforeAll', function(err) { | ||
if (err) { | ||
return done(); | ||
} | ||
if (totalWithoutPending > 0) { | ||
this.hook('beforeAll', function(err) { | ||
if (err) { | ||
return done(); | ||
} | ||
self.runTests(suite, next); | ||
}); | ||
} else { | ||
self.runTests(suite, next); | ||
}); | ||
} | ||
}; | ||
@@ -758,0 +770,0 @@ |
{ | ||
"name": "@johanblumenberg/mocha", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "simple, flexible, fun test framework", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
795520
20754