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 = [ 15 "reportRunnerStarting", 16 "reportRunnerResults", 17 "reportSuiteResults", 18 "reportSpecStarting", 19 "reportSpecResults", 20 "log" 21 ]; 22 for (var i = 0; i < functionNames.length; i++) { 23 var functionName = functionNames[i]; 24 jasmine.MultiReporter.prototype[functionName] = (function(functionName) { 25 return function() { 26 for (var j = 0; j < this.subReporters_.length; j++) { 27 var subReporter = this.subReporters_[j]; 28 if (subReporter[functionName]) { 29 subReporter[functionName].apply(subReporter, arguments); 30 } 31 } 32 }; 33 })(functionName); 34 } 35 })(); 36