Skip to content

Commit

Permalink
'reporter' option instead of boolean flags. Also pass subject to Suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 4, 2010
1 parent e2d1951 commit 8cd49ba
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,12 @@ require.paths.unshift(__dirname);
vows.options = {
Emitter: events.EventEmitter,
brief: false,
json: false,
spec: false,
reporter: require('vows/reporters/dot-matrix'),
matcher: /.*/
};

vows.__defineGetter__('reporter', function () {
if (vows.options.json) {
return require('vows/reporters/json');
} else if (vows.options.spec) {
return require('vows/reporters/spec');
} else {
return require('vows/reporters/dot-matrix');
}
return vows.options.reporter;
});

var stylize = require('vows/console').stylize;
Expand All @@ -51,11 +44,6 @@ vows.prepare = require('vows/extras').prepare;
require('./assert/error');
require('./assert/macros');

//
// Suite constructor
//
var Suite = require('vows/suite').Suite;

//
// Checks if all the tests in the batch have been run,
// and triggers the next batch (if any), by emitting the 'end' event.
Expand All @@ -75,6 +63,11 @@ vows.tryEnd = function (batch) {
}
}

//
// Suite constructor
//
var Suite = require('vows/suite').Suite;

//
// This function gets added to events.EventEmitter.prototype, by default.
// It's essentially a wrapper around `addListener`, which adds all the specification
Expand Down Expand Up @@ -161,7 +154,7 @@ vows.suites = [];
// Create a new test suite
//
vows.describe = function (subject) {
var suite = new(Suite);
var suite = new(Suite)(subject);

this.options.Emitter.prototype.addVow = addVow;
this.suites.push(suite);
Expand Down

0 comments on commit 8cd49ba

Please sign in to comment.