Skip to content

Commit

Permalink
plan() should be optional
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
isaacs committed Nov 25, 2012
1 parent 6192cb5 commit c879198
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Test.prototype.plan = function (n) {

Test.prototype.end = function () {
if (!this.ended) this.emit('end');
if (!this._planError && this.assertCount !== this._plan) {
if (this._plan !== undefined &&
!this._planError && this.assertCount !== this._plan) {
this._planError = true;
this.fail('plan != count', {
expected : this._plan,
Expand Down
15 changes: 15 additions & 0 deletions test/plan_optional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var test = require('../');

test('plan should be optional', function (t) {
t.pass('no plan here');
t.end();
});

test('no plan async', function (t) {
setTimeout(function() {
t.pass('ok');
t.end();
});
});

// vim: set softtabstop=4 shiftwidth=4:

0 comments on commit c879198

Please sign in to comment.