Skip to content
Snippets Groups Projects
Commit fafab603 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

log any error messages to console while tests are running. closes #556

parent 8a76ffe8
No related branches found
No related tags found
No related merge requests found
......@@ -67,20 +67,24 @@ exports.browserid = new events.EventEmitter;
function setupProc(proc) {
var m, sentReady = false;
proc.stdout.on('data', function(x) {
if (process.env['LOG_TO_CONSOLE']) console.log(x.toString());
var tokenRegex = new RegExp('token=([A-Za-z0-9]+)$', 'm');
if (!sentReady && /^browserid.*127\.0\.0\.1:10002/m.test(x)) {
exports.browserid.emit('ready');
sentReady = true;
} else if (m = tokenRegex.exec(x)) {
tokenStack.push(m[1]);
if (nextTokenFunction) {
nextTokenFunction(tokenStack.shift());
nextTokenFunction = undefined;
proc.stdout.on('data', function(buf) {
buf.toString().split('\n').forEach(function(x) {
if (process.env['LOG_TO_CONSOLE'] || /^.*error.*:/.test(x)) {
console.log(x.toString());
}
}
var tokenRegex = new RegExp('token=([A-Za-z0-9]+)$', 'm');
if (!sentReady && /^browserid.*127\.0\.0\.1:10002/.test(x)) {
exports.browserid.emit('ready');
sentReady = true;
} else if (m = tokenRegex.exec(x)) {
tokenStack.push(m[1]);
if (nextTokenFunction) {
nextTokenFunction(tokenStack.shift());
nextTokenFunction = undefined;
}
}
});
});
proc.stderr.on('data', function(x) {
if (process.env['LOG_TO_CONSOLE']) console.log(x.toString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment