Skip to content

Commit

Permalink
Outputs tests with no callbacks as a TODO test.
Browse files Browse the repository at this point in the history
  • Loading branch information
aychtang committed Mar 16, 2014
1 parent 01f320e commit 8817652
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/no_callback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var test = require('../');

test('No cb test');
5 changes: 5 additions & 0 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Test.prototype.plan = function (n) {

Test.prototype.end = function (err) {
var self = this;

if (arguments.length >= 1) {
this.ifError(err);
}
Expand All @@ -110,6 +111,9 @@ Test.prototype.end = function (err) {

Test.prototype._end = function (err) {
var self = this;

if (!this._cb) this.fail('TODO ' + this.name);

if (this._progeny.length) {
var t = this._progeny.shift();
t.on('end', function () { self._end() });
Expand All @@ -118,6 +122,7 @@ Test.prototype._end = function (err) {
}

if (!this.ended) this.emit('end');

var pendingAsserts = this._pendingAsserts();
if (!this._planError && this._plan !== undefined && pendingAsserts) {
this._planError = true;
Expand Down

0 comments on commit 8817652

Please sign in to comment.