Allow for registration of multiple Reporter with Jasmine.

This commit is contained in:
Christian Williams
2009-07-08 17:55:25 -07:00
parent 521f839753
commit a6aa9c652b
7 changed files with 98 additions and 8 deletions

24
src/MultiReporter.js Normal file
View File

@@ -0,0 +1,24 @@
/**
* @constructor
*/
jasmine.MultiReporter = function() {
this.subReporters_ = [];
};
jasmine.MultiReporter.prototype.addReporter = function(reporter) {
this.subReporters_.push(reporter);
};
(function() {
var functionNames = ["reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
for (var i = 0; i < functionNames.length; i++) {
var functionName = functionNames[i];
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
return function() {
for (var j = 0; j < this.subReporters_.length; j++) {
this.subReporters_[j][functionName].apply(this.subReporters_[j], arguments);
}
};
})(functionName);
}
})();