Skip to content

Commit 00509bd

Browse files
committed
[test] Test --supress-stdout flag
1 parent 8ce12a5 commit 00509bd

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/supress-stdout-test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
var assert = require('assert'),
2+
path = require('path'),
3+
vows = require('../lib/vows'),
4+
exec = require('child_process').exec;
5+
6+
function generateTopic(supress) {
7+
return function () {
8+
var cmd = './bin/vows ' + (supress ? '--supress-stdout ' : '') +
9+
'./test/fixtures/supress-stdout/output.js',
10+
options = {cwd: path.resolve(__dirname + '/../')},
11+
callback = this.callback;
12+
13+
exec(cmd, options, function (err, stdout, _) {
14+
callback(null, {err: err, stdout: stdout});
15+
});
16+
};
17+
}
18+
19+
vows.describe('vows/supress-stdout').addBatch({
20+
'Running vows for test/fixtures/supress-stdout/output.js': {
21+
'with --supress-stdout flag': {
22+
topic: generateTopic(true),
23+
'should be ok': function (result) {
24+
assert.isNull(result.err);
25+
},
26+
'should not contain output from stdout': function (result) {
27+
assert.equal(result.stdout.toString().indexOf('goo'), -1);
28+
// console.log output?
29+
// nope, just Chuck Testa!
30+
}
31+
},
32+
'without --supress-stdout flag': {
33+
topic: generateTopic(),
34+
'should be ok': function (result) {
35+
assert.isNull(result.err);
36+
},
37+
'should contain output from stdout': function (result) {
38+
assert.notEqual(result.stdout.toString().indexOf('goo'), -1);
39+
}
40+
}
41+
}
42+
}).export(module);
43+

0 commit comments

Comments
 (0)