Skip to content

Commit 077a108

Browse files
committed
[Refactor] add names to Test.prototype functions
1 parent e6d2faf commit 077a108

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/test.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function Test(name_, opts_, cb_) {
9696
}
9797
}
9898

99-
Test.prototype.run = function () {
99+
Test.prototype.run = function run() {
100100
this.emit('prerun');
101101
if (!this._cb || this._skip) {
102102
return this._end();
@@ -131,7 +131,7 @@ Test.prototype.run = function () {
131131
this.emit('run');
132132
};
133133

134-
Test.prototype.test = function (name, opts, cb) {
134+
Test.prototype.test = function test(name, opts, cb) {
135135
var self = this;
136136
var t = new Test(name, opts, cb);
137137
$push(this._progeny, t);
@@ -154,19 +154,19 @@ Test.prototype.test = function (name, opts, cb) {
154154
});
155155
};
156156

157-
Test.prototype.comment = function (msg) {
157+
Test.prototype.comment = function comment(msg) {
158158
var that = this;
159159
forEach($split(trim(msg), '\n'), function (aMsg) {
160160
that.emit('result', $replace(trim(aMsg), /^#\s*/, ''));
161161
});
162162
};
163163

164-
Test.prototype.plan = function (n) {
164+
Test.prototype.plan = function plan(n) {
165165
this._plan = n;
166166
this.emit('plan', n);
167167
};
168168

169-
Test.prototype.timeoutAfter = function (ms) {
169+
Test.prototype.timeoutAfter = function timeoutAfter(ms) {
170170
if (!ms) throw new Error('timeoutAfter requires a timespan');
171171
var self = this;
172172
var timeout = safeSetTimeout(function () {
@@ -178,7 +178,7 @@ Test.prototype.timeoutAfter = function (ms) {
178178
});
179179
};
180180

181-
Test.prototype.end = function (err) {
181+
Test.prototype.end = function end(err) {
182182
var self = this;
183183
if (arguments.length >= 1 && !!err) {
184184
this.ifError(err);
@@ -191,15 +191,15 @@ Test.prototype.end = function (err) {
191191
this._end();
192192
};
193193

194-
Test.prototype.teardown = function (fn) {
194+
Test.prototype.teardown = function teardown(fn) {
195195
if (typeof fn !== 'function') {
196196
this.fail('teardown: ' + inspect(fn) + ' is not a function');
197197
} else {
198198
this._teardown.push(fn);
199199
}
200200
};
201201

202-
Test.prototype._end = function (err) {
202+
Test.prototype._end = function _end(err) {
203203
var self = this;
204204

205205
if (!this._cb && !this._todo && !this._skip) this.fail('# TODO ' + this.name);
@@ -249,7 +249,7 @@ Test.prototype._end = function (err) {
249249
}
250250
};
251251

252-
Test.prototype._exit = function () {
252+
Test.prototype._exit = function _exit() {
253253
if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) {
254254
this._planError = true;
255255
this.fail('plan != count', {
@@ -264,7 +264,7 @@ Test.prototype._exit = function () {
264264
}
265265
};
266266

267-
Test.prototype._pendingAsserts = function () {
267+
Test.prototype._pendingAsserts = function _pendingAsserts() {
268268
if (this._plan === undefined) {
269269
return 1;
270270
}
@@ -394,23 +394,23 @@ Test.prototype._assert = function assert(ok, opts) {
394394
}
395395
};
396396

397-
Test.prototype.fail = function (msg, extra) {
397+
Test.prototype.fail = function fail(msg, extra) {
398398
this._assert(false, {
399399
message: msg,
400400
operator: 'fail',
401401
extra: extra
402402
});
403403
};
404404

405-
Test.prototype.pass = function (msg, extra) {
405+
Test.prototype.pass = function pass(msg, extra) {
406406
this._assert(true, {
407407
message: msg,
408408
operator: 'pass',
409409
extra: extra
410410
});
411411
};
412412

413-
Test.prototype.skip = function (msg, extra) {
413+
Test.prototype.skip = function skip(msg, extra) {
414414
this._assert(true, {
415415
message: msg,
416416
operator: 'skip',
@@ -676,7 +676,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) {
676676
});
677677
};
678678

679-
Test.prototype.doesNotThrow = function (fn, expected, msg, extra) {
679+
Test.prototype.doesNotThrow = function doesNotThrow(fn, expected, msg, extra) {
680680
if (typeof expected === 'string') {
681681
msg = expected;
682682
expected = undefined;
@@ -741,7 +741,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra)
741741
});
742742
};
743743

744-
Test.skip = function (name_, _opts, _cb) {
744+
Test.skip = function skip(name_, _opts, _cb) {
745745
var args = getTestArgs.apply(null, arguments);
746746
args.opts.skip = true;
747747
return Test(args.name, args.opts, args.cb);

0 commit comments

Comments
 (0)