1 /** 2 * @constructor 3 */ 4 jasmine.MultiReporter = function() { 5 this.subReporters_ = []; 6 }; 7 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); 8 9 jasmine.MultiReporter.prototype.addReporter = function(reporter) { 10 this.subReporters_.push(reporter); 11 }; 12 13 (function() { 14 var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"]; 15 for (var i = 0; i < functionNames.length; i++) { 16 var functionName = functionNames[i]; 17 jasmine.MultiReporter.prototype[functionName] = (function(functionName) { 18 return function() { 19 for (var j = 0; j < this.subReporters_.length; j++) { 20 var subReporter = this.subReporters_[j]; 21 if (subReporter[functionName]) { 22 subReporter[functionName].apply(subReporter, arguments); 23 } 24 } 25 }; 26 })(functionName); 27 } 28 })(); 29