Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As well as a test for the BashReporter
- Loading branch information
Showing
2 changed files
with
39 additions
and
7 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
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,32 @@ | ||
var assert = require('assert'); | ||
var BashReporter = require('../../lib/reporter/BashReporter'); | ||
var EventEmitter = require('events').EventEmitter; | ||
|
||
(function testOutputOfFailedTests() { | ||
var process = new EventEmitter(); | ||
var collection = new EventEmitter(); | ||
var reporter = new BashReporter({process: process, collection: collection}); | ||
|
||
var stdout = ''; | ||
process.stdout = { | ||
write: function(chunk) { | ||
stdout += chunk; | ||
}, | ||
} | ||
|
||
var testCase = {name: 'MyTestCase'}; | ||
var test = 'is awesome'; | ||
var error = {stack: 'Something went wrong:\nLine2\nLine3'}; | ||
|
||
collection.emit('fail', testCase, test, error); | ||
|
||
assert.equal( | ||
stdout, | ||
'Failed: MyTestCase is awesome\n' + | ||
'\n' + | ||
' Something went wrong:\n' + | ||
' Line2\n' + | ||
' Line3\n' + | ||
'\n' | ||
); | ||
})(); |