Skip to content

Commit

Permalink
[test] Test --supress-stdout flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Oct 14, 2011
1 parent 8ce12a5 commit 00509bd
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/supress-stdout-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var assert = require('assert'),
path = require('path'),
vows = require('../lib/vows'),
exec = require('child_process').exec;

function generateTopic(supress) {
return function () {
var cmd = './bin/vows ' + (supress ? '--supress-stdout ' : '') +
'./test/fixtures/supress-stdout/output.js',
options = {cwd: path.resolve(__dirname + '/../')},
callback = this.callback;

exec(cmd, options, function (err, stdout, _) {
callback(null, {err: err, stdout: stdout});
});
};
}

vows.describe('vows/supress-stdout').addBatch({
'Running vows for test/fixtures/supress-stdout/output.js': {
'with --supress-stdout flag': {
topic: generateTopic(true),
'should be ok': function (result) {
assert.isNull(result.err);
},
'should not contain output from stdout': function (result) {
assert.equal(result.stdout.toString().indexOf('goo'), -1);
// console.log output?
// nope, just Chuck Testa!
}
},
'without --supress-stdout flag': {
topic: generateTopic(),
'should be ok': function (result) {
assert.isNull(result.err);
},
'should contain output from stdout': function (result) {
assert.notEqual(result.stdout.toString().indexOf('goo'), -1);
}
}
}
}).export(module);

0 comments on commit 00509bd

Please sign in to comment.