Skip to content

Commit 2b7398e

Browse files
author
cloudhead
committed
ability to pass suite options to export method
1 parent 4fc9097 commit 2b7398e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

bin/vows

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ var help = [
3939
var options = {
4040
reporter: reporter,
4141
matcher: /.*/,
42-
watch: false,
43-
error: true
42+
watch: false
4443
};
4544

4645
var files = [];

lib/vows/suite.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ this.Suite = function (subject) {
1111
this.matcher = /.*/;
1212
this.reporter = require('vows/reporters/dot-matrix');
1313
this.batches = [];
14+
this.options = { error: true };
1415
this.reset();
1516
};
1617

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

220221
options = options || {};
221222

222-
this.matcher = options.matcher || this.matcher;
223-
this.reporter = options.reporter || this.reporter;
224-
this.options = options;
223+
for (var k in options) { this.options[k] = options[k] }
224+
225+
this.matcher = this.options.matcher || this.matcher;
226+
this.reporter = this.options.reporter || this.reporter;
225227

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

266268
this.runParallel = function () {};
267269

268-
this.export = function (module) {
270+
this.export = function (module, options) {
271+
for (var k in (options || {})) { this.options[k] = options[k] }
272+
269273
if (require.main === module) {
270274
return this.run();
271275
} else {

0 commit comments

Comments
 (0)