function timeslice(){for(var e=(new Date).getTime();immediateQueue.length&&(new Date).getTime()-e<100;)immediateQueue.shift()();immediateTimeout=immediateQueue.length?setTimeout(timeslice,0):null}process.stdout=require("browser-stdout")();var Mocha=require("./lib/mocha"),mocha=new Mocha({reporter:"html"}),Date=global.Date,setTimeout=global.setTimeout,setInterval=global.setInterval,clearTimeout=global.clearTimeout,clearInterval=global.clearInterval,uncaughtExceptionHandlers=[],originalOnerrorHandler=global.onerror;process.removeListener=function(e,o){if("uncaughtException"==e){originalOnerrorHandler?global.onerror=originalOnerrorHandler:global.onerror=function(){};var t=Mocha.utils.indexOf(uncaughtExceptionHandlers,o);t!=-1&&uncaughtExceptionHandlers.splice(t,1)}},process.on=function(e,o){"uncaughtException"==e&&(global.onerror=function(e,t,r){return o(new Error(e+" ("+t+":"+r+")")),!mocha.allowUncaught},uncaughtExceptionHandlers.push(o))},mocha.suite.removeAllListeners("pre-require");var immediateQueue=[],immediateTimeout;Mocha.Runner.immediately=function(e){immediateQueue.push(e),immediateTimeout||(immediateTimeout=setTimeout(timeslice,0))},mocha.throwError=function(e){throw Mocha.utils.forEach(uncaughtExceptionHandlers,function(o){o(e)}),e},mocha.ui=function(e){return Mocha.prototype.ui.call(this,e),this.suite.emit("pre-require",global,null,this),this},mocha.setup=function(e){"string"==typeof e&&(e={ui:e});for(var o in e)this[o](e[o]);return this},mocha.run=function(e){var o=mocha.options;mocha.globals("location");var t=Mocha.utils.parseQuery(global.location.search||"");return t.grep&&mocha.grep(new RegExp(t.grep)),t.fgrep&&mocha.grep(t.fgrep),t.invert&&mocha.invert(),Mocha.prototype.run.call(mocha,function(t){var r=global.document;r&&r.getElementById("mocha")&&o.noHighlighting!==!0&&Mocha.utils.highlightTags("code"),e&&e(t)})},Mocha.process=process,global.Mocha=Mocha,global.mocha=mocha,module.exports=global;