1 /* JasmineReporters.reporter
  2  *    Base object that will get called whenever a Spec, Suite, or Runner is done.  It is up to
  3  *    descendants of this object to do something with the results (see json_reporter.js)
  4  */
  5 jasmine.Reporters = {};
  6 
  7 jasmine.Reporters.reporter = function(callbacks) {
  8   var that = {
  9     callbacks: callbacks || {},
 10 
 11     doCallback: function(callback, results) {
 12       if (callback) {
 13         callback(results);
 14       }
 15     },
 16 
 17     reportRunnerResults: function(runner) {
 18       that.doCallback(that.callbacks.runnerCallback, runner);
 19     },
 20     reportSuiteResults:  function(suite) {
 21       that.doCallback(that.callbacks.suiteCallback, suite);
 22     },
 23     reportSpecResults:   function(spec) {
 24       that.doCallback(that.callbacks.specCallback, spec);
 25     },
 26     log: function (str) {
 27       if (console && console.log) console.log(str);
 28     }
 29   };
 30 
 31   return that;
 32 };
 33 
 34