Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Corrected test harness
  • Loading branch information
AngryLawyer committed May 18, 2016
1 parent c846b22 commit e89b077
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions test/alcotest-adapter.js
Expand Up @@ -37,16 +37,24 @@
var id = items[1];
var name = items[2];

// Next line is either empty, or an error code
var errorLine = resultBuffer[1];
var success = true;
var errorText = [];
if (errorLine.indexOf('[failure]') === 0) {
success = false;
var errorsEnd = findNextIndex(resultBuffer, function (line) {
return (/^\[ERROR\]/.test(line));
});
errorText = resultBuffer.slice(1, errorsEnd).filter(function (item) { return item.trim(); });
// Find an error line
var lineIdx = 1;
while (lineIdx < resultBuffer.length) {
var errorLine = resultBuffer[lineIdx];
var success = true;
var errorText = [];
if (errorLine.indexOf('[failure]') === 0) {
success = false;
var errorsEnd = findNextIndex(resultBuffer, function (line) {
return (/^\[ERROR\]/.test(line));
});
errorText = resultBuffer.slice(1, errorsEnd).filter(function (item) { return item.trim(); });
break;
}
if (/\.\.\./.test(errorLine)) {
break;
}
lineIdx += 1;
}

var result = {
Expand Down Expand Up @@ -80,7 +88,7 @@
function createStartFn(karma) {
return function () {
win.startTests();
parseResults(karma, win.stdout_buffer.map(stripControlSequences));
parseResults(karma, win.stdout_buffer.map(stripControlSequences).join("\n").split("\n"));

karma.complete({});
};
Expand Down

0 comments on commit e89b077

Please sign in to comment.