Skip to content

Commit

Permalink
exported Suites also run automatically when file is run directly
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 4, 2010
1 parent 244cd01 commit af04a10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ this.Suite.prototype = new(function () {

this.runParallel = function () {};

this.export = function (exports) {
return exports.vows = this;
this.export = function (module) {
if (require.main === module) {
return this.run();
} else {
return module.exports.vows = this;
}
};
});
2 changes: 1 addition & 1 deletion test/other-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ vows.describe("Vows/other").addVows({
assert.ok (topic);
}
}
}).export(this);
}).export(module);
2 changes: 1 addition & 1 deletion test/vows-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ vows.describe("Vows").addVows({
"A 3rd test suite": {
"should run last": function () {}
}
}).export(this);
}).export(module);

0 comments on commit af04a10

Please sign in to comment.