Skip to content

Commit

Permalink
ability to pass suite options to export method
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jul 1, 2010
1 parent 4fc9097 commit 2b7398e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ var help = [
var options = {
reporter: reporter,
matcher: /.*/,
watch: false,
error: true
watch: false
};

var files = [];
Expand Down
12 changes: 8 additions & 4 deletions lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ this.Suite = function (subject) {
this.matcher = /.*/;
this.reporter = require('vows/reporters/dot-matrix');
this.batches = [];
this.options = { error: true };
this.reset();
};

Expand Down Expand Up @@ -219,9 +220,10 @@ this.Suite.prototype = new(function () {

options = options || {};

this.matcher = options.matcher || this.matcher;
this.reporter = options.reporter || this.reporter;
this.options = options;
for (var k in options) { this.options[k] = options[k] }

this.matcher = this.options.matcher || this.matcher;
this.reporter = this.options.reporter || this.reporter;

this.batches.forEach(function (batch) {
that.parseBatch(batch, that.matcher);
Expand Down Expand Up @@ -265,7 +267,9 @@ this.Suite.prototype = new(function () {

this.runParallel = function () {};

this.export = function (module) {
this.export = function (module, options) {
for (var k in (options || {})) { this.options[k] = options[k] }

if (require.main === module) {
return this.run();
} else {
Expand Down

0 comments on commit 2b7398e

Please sign in to comment.