Skip to content

Commit 149ceb3

Browse files
committed
add Test.prototype._checkPlanCount()
1 parent 4435858 commit 149ceb3

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,23 @@ Test.prototype._end = function (err) {
169169
this.exit();
170170
};
171171

172-
Test.prototype.exit = function () {
173-
var self = this;
174-
175-
function checkAssertLength() {
176-
if (self.assertError === undefined && self.planCount !== null && self.planCount !== self.assertions.length) {
177-
self._setAssertError(new assert.AssertionError({
178-
actual: self.assertions.length,
179-
expected: self.planCount,
180-
message: 'Assertion count does not match planned',
181-
operator: 'plan'
182-
}));
172+
Test.prototype._checkPlanCount = function () {
173+
if (this.assertError === undefined && this.planCount !== null && this.planCount !== this.assertions.length) {
174+
this._setAssertError(new assert.AssertionError({
175+
actual: this.assertions.length,
176+
expected: this.planCount,
177+
message: 'Assertion count does not match planned',
178+
operator: 'plan'
179+
}));
183180

184-
self.assertError.stack = self.planStack;
185-
}
181+
this.assertError.stack = this.planStack;
186182
}
183+
};
184+
185+
Test.prototype.exit = function () {
186+
var self = this;
187187

188-
checkAssertLength();
188+
this._checkPlanCount();
189189

190190
Promise.all(this.assertions)
191191
.catch(function (err) {
@@ -198,7 +198,7 @@ Test.prototype.exit = function () {
198198
// stop infinite timer
199199
globals.clearTimeout(self._timeout);
200200

201-
checkAssertLength();
201+
self._checkPlanCount();
202202

203203
if (!self.ended) {
204204
self.ended = true;

0 commit comments

Comments
 (0)