Commit 266e59f3 authored by Calvin Metcalf's avatar Calvin Metcalf
Browse files

final clean up

parent 2b455d9e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -46,6 +46,5 @@ module.exports = function(grunt) {
	grunt.registerTask('full', ['concat:full','uglify:full']);
	grunt.registerTask('noDefs', ['concat:noDefs','uglify:noDefs']);
	grunt.registerTask('test', ['connect', 'mocha_phantomjs']);
	//grunt.registerTask('c9', ['connect', 'mocha_phantomjs:c9']);
	grunt.registerTask('default', ['full','noDefs','test']);
}
+4 −5
Original line number Diff line number Diff line
@@ -20,11 +20,10 @@
  <script src="testdata.js"></script>
  <script src="test.js"></script>
  <script>
    if (window.mochaPhantomJS) { 
      mochaPhantomJS.run(); 
    } else {
      mocha.run(); 
    }
    window.onload = function() {
          if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
      else { mocha.run(); }
      };
  </script>
</body>
</html>
 No newline at end of file
+5338 −5372
Original line number Diff line number Diff line
;(function(){


// CommonJS require()

function require(p){
@@ -51,9 +52,9 @@ require.register("browser/debug.js", function(module, exports, require){

module.exports = function(type){
  return function(){
    
  }
};

}); // module: browser/debug.js

require.register("browser/diff.js", function(module, exports, require){
@@ -804,6 +805,7 @@ Hook.prototype.error = function(err){
  this._error = err;
};


}); // module: hook.js

require.register("interfaces/bdd.js", function(module, exports, require){
@@ -1004,7 +1006,6 @@ module.exports = function(suite){
    }
  }
};

}); // module: interfaces/exports.js

require.register("interfaces/index.js", function(module, exports, require){
@@ -1053,7 +1054,7 @@ var Suite = require('../suite')
module.exports = function(suite){
  var suites = [suite];

  suite.on('pre-require', function(context, file, mocha){
  suite.on('pre-require', function(context){

    /**
     * Execute before running tests.
@@ -1095,16 +1096,6 @@ module.exports = function(suite){
      if (suites.length > 1) suites.shift();
      var suite = Suite.create(suites[0], title);
      suites.unshift(suite);
      return suite;
    };

    /**
     * Exclusive test-case.
     */

    context.suite.only = function(title, fn){
      var suite = context.suite(title, fn);
      mocha.grep(suite.fullTitle());
    };

    /**
@@ -1114,26 +1105,7 @@ module.exports = function(suite){
     */

    context.test = function(title, fn){
      var test = new Test(title, fn);
      suites[0].addTest(test);
      return test;
    };

    /**
     * Exclusive test-case.
     */

    context.test.only = function(title, fn){
      var test = context.test(title, fn);
      mocha.grep(test.fullTitle());
    };

    /**
     * Pending test case.
     */

    context.test.skip = function(title){
      context.test(title);
      suites[0].addTest(new Test(title, fn));
    };
  });
};
@@ -1577,7 +1549,7 @@ Mocha.prototype.run = function(fn){
  var options = this.options;
  var runner = new exports.Runner(suite);
  var reporter = new this._reporter(runner);
  runner.ignoreLeaks = false !== options.ignoreLeaks;
  runner.ignoreLeaks = options.ignoreLeaks;
  runner.asyncOnly = options.asyncOnly;
  if (options.grep) runner.grep(options.grep, options.invert);
  if (options.globals) runner.globals(options.globals);
@@ -1844,7 +1816,10 @@ exports.list = function(failures){

    // actual / expected diff
    if ('string' == typeof actual && 'string' == typeof expected) {
      msg = errorDiff(err, 'Words', escape);
      var len = Math.max(actual.length, expected.length);

      if (len < 20) msg = errorDiff(err, 'Chars', escape);
      else msg = errorDiff(err, 'Words', escape);

      // linenos
      var lines = msg.split('\n');
@@ -2359,6 +2334,8 @@ function HTML(runner, root) {
  });

  runner.on('test end', function(test){
    window.scrollTo(0, document.body.scrollHeight);

    // TODO: add to stats
    var percent = stats.tests / this.total * 100 | 0;
    if (progress) progress.update(percent).draw(ctx);
@@ -3123,10 +3100,10 @@ F.prototype = Base.prototype;
Min.prototype = new F;
Min.prototype.constructor = Min;


}); // module: reporters/min.js

require.register("reporters/nyan.js", function(module, exports, require){

/**
 * Module dependencies.
 */
@@ -3272,20 +3249,22 @@ NyanCat.prototype.drawRainbow = function(){
NyanCat.prototype.drawNyanCat = function(status) {
  var self = this;
  var startWidth = this.scoreboardWidth + this.trajectories[0].length;
  var color = '\u001b[' + startWidth + 'C';
  var padding = '';

  write(color);
  [0, 1, 2, 3].forEach(function(index) {
    write('\u001b[' + startWidth + 'C');

    switch (index) {
      case 0:
        write('_,------,');
        write('\n');
  
  write(color);
  padding = self.tick ? '  ' : '   ';
        break;
      case 1:
        var padding = self.tick ? '  ' : '   ';
        write('_|' + padding + '/\\_/\\ ');
        write('\n');
  
  write(color);
  padding = self.tick ? '_' : '__';
        break;
      case 2:
        var padding = self.tick ? '_' : '__';
        var tail = self.tick ? '~' : '^';
        var face;
        switch (status) {
@@ -3300,11 +3279,14 @@ NyanCat.prototype.drawNyanCat = function(status) {
        }
        write(tail + '|' + padding + face + ' ');
        write('\n');
  
  write(color);
  padding = self.tick ? ' ' : '  ';
        break;
      case 3:
        var padding = self.tick ? ' ' : '  ';
        write(padding + '""  "" ');
        write('\n');
        break;
    }
  });

  this.cursorUp(this.numberOfLines);
};
@@ -4083,7 +4065,8 @@ var EventEmitter = require('browser/events').EventEmitter
  , Test = require('./test')
  , utils = require('./utils')
  , filter = utils.filter
  , keys = utils.keys;
  , keys = utils.keys
  , noop = function(){};

/**
 * Non-enumerable globals.
@@ -4135,15 +4118,6 @@ function Runner(suite) {
  this.globals(this.globalProps().concat(['errno']));
}

/**
 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
 *
 * @param {Function} fn
 * @api private
 */

Runner.immediately = global.setImmediate || process.nextTick;

/**
 * Inherit from `EventEmitter.prototype`.
 */
@@ -4329,7 +4303,7 @@ Runner.prototype.hook = function(name, fn){
    });
  }

  Runner.immediately(function(){
  process.nextTick(function(){
    next(0);
  });
};
@@ -4570,11 +4544,10 @@ Runner.prototype.uncaught = function(err){

Runner.prototype.run = function(fn){
  var self = this
    , fn = fn || function(){};

  function uncaught(err){
    , fn = fn || function(){}
    , uncaught = function(err){
      self.uncaught(err);
  }
    };

  debug('start');

@@ -4609,8 +4582,6 @@ Runner.prototype.run = function(fn){

function filterLeaks(ok, globals) {
  return filter(globals, function(key){
    // Firefox and Chrome exposes iframes as index inside the window object
    if (/^d+/.test(key)) return false;
    var matched = filter(ok, function(ok){
      if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
      // Opera and IE expose global variables for HTML element IDs (issue #243)
@@ -5252,17 +5223,6 @@ exports.highlightTags = function(name) {
};

}); // module: utils.js

/**
 * Save timer references to avoid Sinon interfering (see GH-237).
 */

var Date = window.Date;
var setTimeout = window.setTimeout;
var setInterval = window.setInterval;
var clearTimeout = window.clearTimeout;
var clearInterval = window.clearInterval;

/**
 * Node shims.
 *
@@ -5272,11 +5232,39 @@ var clearInterval = window.clearInterval;
 * the browser.
 */

var process = {};
process = {};
process.exit = function(status){};
process.stdout = {};
global = window;

/**
 * next tick implementation.
 */

process.nextTick = (function(){
  // postMessage behaves badly on IE8
  if (window.ActiveXObject || !window.postMessage) {
    return function(fn){ fn() };
  }

  // based on setZeroTimeout by David Baron
  // - http://dbaron.org/log/20100309-faster-timeouts
  var timeouts = []
    , name = 'mocha-zero-timeout'

  window.addEventListener('message', function(e){
    if (e.source == window && e.data == name) {
      if (e.stopPropagation) e.stopPropagation();
      if (timeouts.length) timeouts.shift()();
    }
  }, true);

  return function(fn){
    timeouts.push(fn);
    window.postMessage(name, '*');
  }
})();

/**
 * Remove uncaughtException listener.
 */
@@ -5299,6 +5287,9 @@ process.on = function(e, fn){
  }
};

// boot
;(function(){

  /**
   * Expose mocha.
   */
@@ -5306,32 +5297,6 @@ process.on = function(e, fn){
  var Mocha = window.Mocha = require('mocha'),
      mocha = window.mocha = new Mocha({ reporter: 'html' });

var immediateQueue = []
  , immediateTimeout;

function timeslice() {
  var immediateStart = new Date().getTime();
  while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
    immediateQueue.shift()();
  }
  if (immediateQueue.length) {
    immediateTimeout = setTimeout(timeslice, 0);
  } else {
    immediateTimeout = null;
  }
}

/**
 * High-performance override of Runner.immediately.
 */

Mocha.Runner.immediately = function(callback) {
  immediateQueue.push(callback);
  if (!immediateTimeout) {
    immediateTimeout = setTimeout(timeslice, 0);
  }
};

  /**
   * Override ui to ensure that the ui functions are initialized.
   * Normally this would happen in Mocha.prototype.loadFiles.
@@ -5371,3 +5336,4 @@ mocha.run = function(fn){
    });
  };
})();
})();
 No newline at end of file