Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
window.process = { env: {} }; | ||
|
||
var BANNER = ""; | ||
|
||
if(!Object.keys) | ||
Object.keys = function(o){ | ||
if(typeof o !== 'object') | ||
throw new Error('Object.keys called on non-object: ' + JSON.stringify(o)); | ||
var ret=[], p; | ||
for (p in o) | ||
if(Object.prototype.hasOwnProperty.call(o,p)) | ||
ret.push(p); | ||
return ret; | ||
} | ||
|
||
if(!Array.isArray) | ||
Array.isArray = function(o) { | ||
return Object.prototype.toString.call(o) === '[object Array]'; | ||
} | ||
|
||
if(!Array.prototype.forEach) | ||
Array.prototype.forEach = function(callback) { | ||
var i, len = this.length; | ||
for(var i = 0; i < len; i++) | ||
callback(this[i], i, this); | ||
} | ||
|
||
if(!Array.prototype.reduce) | ||
Array.prototype.reduce = function(callback, state) { | ||
var i, len = this.length; | ||
for(i = 0; i < len; i++) | ||
state = callback(state, this[i]); | ||
return state; | ||
} | ||
|
||
if(!Array.prototype.filter) | ||
Array.prototype.filter = function(pred) { | ||
var i, len = this.length, result = []; | ||
for(i = 0; i < len; i++) | ||
if(!! pred(this[i])) | ||
result.push(this[i]); | ||
return result; | ||
} | ||
|
||
if(!Array.prototype.map) | ||
Array.prototype.map = function(func) { | ||
var i, len = this.length, result = []; | ||
for(i = 0; i < len; i++) | ||
result.push(func(this[i], i, this)); | ||
return result; | ||
} | ||
|
||
|
||
if(!window.console) | ||
window.console = {}; | ||
|
||
; ['trace', 'debug', 'log', 'info', 'warn', 'error', 'fatal'].forEach(function(lev) { | ||
window.console[lev] = window.console[lev] || function() {}; | ||
}) | ||
|
||
define(['events', 'querystring', 'follow/cli'], function(events, querystring, cli) { | ||
jQuery('#boot').html('Starting' + (BANNER ? (' '+BANNER) : "")); | ||
// Set up some faux Node stuff. | ||
events.EventEmitter = events.EventEmitter2; | ||
var process = window.process = new events.EventEmitter; | ||
|
||
process.env = querystring.parse(window.location.search.slice(1)); | ||
|
||
process.stdout = {}; | ||
process.stdout.write = function(x) { | ||
var con = jQuery('#results'); | ||
var html = con.html(); | ||
con.html(html + x); | ||
} | ||
|
||
process.exit = function(code) { | ||
if(code === 0) | ||
console.log("'EXIT' " + code); | ||
else | ||
console.error("'EXIT' " + code); | ||
} | ||
|
||
|
||
return function() { // main() | ||
console.log('Main running'); | ||
|
||
try { cli.main() } | ||
catch(er) { console.log("Error starting tests"); console.log(er) } | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters