Skip to content

Instantly share code, notes, and snippets.

@Hounddog
Created May 14, 2012 17:27
Show Gist options
  • Save Hounddog/2695194 to your computer and use it in GitHub Desktop.
Save Hounddog/2695194 to your computer and use it in GitHub Desktop.
Dojo Object Harness Continuous integration
var connect = require('connect');
var app = connect()
// .use(connect.logger('dev'))
.use(connect.static('public'))
.use(function(req, res){
var body = '404 page not found';
res.statusCode = 404;
res.setHeader('Content-Length', body.length);
res.end(body);
})
.listen(8080);
var io = require('socket.io').listen(app)
io.set('log level', 1);
io.sockets.on('connection', function (socket) {
socket.on('debug', function (message) {
console.log(message);
});
socket.on('close', function(val){
if(val) {
console.log('all tests completed successfully');
} else {
console.log('tests failed');
}
})
});
install through npm
need to include
<script src="/socket.io/socket.io.js></script> into runner.html
{
"name": "DOH CL",
"version": "0.0.1",
"author": {
"name": "Martin Shwalbe",
"email": "[email protected]"
},
"description": "DOH Commandline Integration fro browser runner",
"main": "",
"repository": {
"type": "git",
"url": "git://github.com/Hounddog/..."
},
"keywords": [
"nodeapps",
"dojo",
"doh"
],
"homepage": "",
"scripts": {
"start": "node ./bin/server.js"
},
"dependencies": {
"socket.io": "=0.9.5"
},
"devDependencies": {
"connect": "=2.1.2"
},
"engines": {
"node": ">=0.6.15"
},
"bugs": {
"url": "https://github.com/Hounddog/..."
},
"licenses": [
{
"type": "MIT",
"url": "..."
}
]
}
define(["doh/runner"], function(doh) {
var origDebug = doh.debug;
var socket = io.connect();
doh.debug = function() {
// var myArguments = arguments;
origDebug(arguments);
socket.emit('debug',Array.prototype.join.call(arguments, " ") );
};
var origReport = doh._report;
doh._report = function() {
origReport();
if(this._failureCount >0) {
socket.emit('close', false);
} else {
socket.emit('close', true);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment