Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support `if main`

  • Loading branch information...
commit c65a58d3e710d7842ea6a2fe1fcc6e2659e7def6 1 parent 804d874
@5long authored
Showing with 4 additions and 2 deletions.
  1. +2 −0  example/all_in_one.js
  2. +2 −2 src/runner.js
View
2  example/all_in_one.js
@@ -2,6 +2,8 @@ var reut = require("reut")
, EE = require("events").EventEmitter
, fs = require("fs")
+if (module == require.main) process.nextTick(reut.run)
+
reut.suite("A suite to contain 'em all")
.setup(function(fixture, done) {
fixture.answer = 42
View
4 src/runner.js
@@ -23,7 +23,7 @@ var runner = module.exports = {
}
, run: function(opt, cb) {
if (arguments.length < 2) cb = opt
- var reporters = opt.reporters || defaultReporters
+ var reporters = opt && opt.reporters || defaultReporters
async.paraMap(suites, function(suite) {
reporters.forEach(function(r) {
suite.reportTo(r)
@@ -31,7 +31,7 @@ var runner = module.exports = {
suite.run(this)
}, function(err, result) {
process.emit("_reutTestEnd")
- cb.apply(this, arguments)
+ cb && cb.apply(this, arguments)
})
}
, _suites: suites
Please sign in to comment.
Something went wrong with that request. Please try again.