-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|