Created
January 10, 2013 16:11
-
-
Save jcoglan/4503284 to your computer and use it in GitHub Desktop.
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
var faye = require('faye'), | |
nopt = require('nopt'), | |
jstest = require('./jstest'), | |
port = 7337, | |
params = nopt({format: String}) | |
var server = new faye.NodeAdapter({mount: '/'}), | |
client = new faye.Client('http://localhost:' + port + '/'), | |
queue = [], | |
index = 0 | |
server.listen(port) | |
var R = jstest.Test.Reporters, | |
r = new R.Composite(), | |
Printer = R.find(params.format || 'dot') | |
r.addReporter(new Printer()) | |
r.addReporter(new R.ExitStatus()) | |
client.subscribe('/report', function(message) { | |
var msgid = message[0], method, event | |
queue[msgid] = message | |
while (queue[index]) { | |
method = queue[index][1] | |
event = queue[index][2] | |
r[method](event) | |
index += 1 | |
} | |
}) | |
client.subscribe('/ping', function() { | |
client.publish('/reload', {}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment