diff --git a/lib/vows/suite.js b/lib/vows/suite.js index cc2cfd3..403894f 100644 --- a/lib/vows/suite.js +++ b/lib/vows/suite.js @@ -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; + } }; }); diff --git a/test/other-test.js b/test/other-test.js index a4d0d94..013a50c 100644 --- a/test/other-test.js +++ b/test/other-test.js @@ -12,4 +12,4 @@ vows.describe("Vows/other").addVows({ assert.ok (topic); } } -}).export(this); +}).export(module); diff --git a/test/vows-test.js b/test/vows-test.js index 01fde4d..99a6215 100644 --- a/test/vows-test.js +++ b/test/vows-test.js @@ -272,4 +272,4 @@ vows.describe("Vows").addVows({ "A 3rd test suite": { "should run last": function () {} } -}).export(this); +}).export(module);