lib/resultCollector.js
function collectResults(resultsGlob) {
    var glob = require("glob"),
        fs = require("fs"),
        Q = require('q'),
        JunitConverter = require("./formats/junitConverter"),
        response = {},
        count = 0,
        specs,
        files = [],
        converter,
        result;

    for (var i = 0; i < resultsGlob.length; i++) {
        files = files.concat(glob.sync(resultsGlob[i]));
    }

    var converterCallback = function(output) {
        result = output;
    };

    for (i = 0; i < files.length; i++) {
        if (files[i].indexOf(".xml") !== -1) {
            converter = new JunitConverter(files[i]);
            converter.exec(converterCallback);
        } else {
            try {
                result = JSON.parse(fs.readFileSync(files[i]));
            } catch (err) {
                console.log('Error parsing JSON of ' + files[i]);
                result = {};
            }
        }
        response = mergeResults(result, response);
        count++;
    }
    return Q.fcall(function () {
        return response;
    });
}
function collectResults(resultsGlob) {
    var glob = require("glob"),
        fs = require("fs"),
        Q = require('q'),
        JunitConverter = require("./formats/junitConverter"),
        response = {},
        count = 0,
        specs,
        files = [],
        converter,
        result;

    for (var i = 0; i < resultsGlob.length; i++) {
        files = files.concat(glob.sync(resultsGlob[i]));
    }

    var converterCallback = function(output) {
        result = output;
    };

    for (i = 0; i < files.length; i++) {
        if (files[i].indexOf(".xml") !== -1) {
            converter = new JunitConverter(files[i]);
            converter.exec(converterCallback);
        } else {
            try {
                result = JSON.parse(fs.readFileSync(files[i]));
            } catch (err) {
                console.log('Error parsing JSON of ' + files[i]);
                result = {};
            }
        }
        response = mergeResults(result, response);
        count++;
    }
    return Q.fcall(function () {
        return response;
    });
}
function collectResults ( resultsGlob ) { var glob = require ( "glob" ) , fs = require ( "fs" ) , Q = require ( 'q' ) , JunitConverter = require ( "./formats/junitConverter" ) , response = { } , count = 0 , specs , files = [ ] , converter , result ; for ( var i = 0 ; i < resultsGlob . length ; i ++ ) { files = files . concat ( glob . sync ( resultsGlob [ i ] ) ) ; } var converterCallback = function ( output ) { result = output ; } ; for ( i = 0 ; i < files . length ; i ++ ) { if ( files [ i ] . indexOf ( ".xml" ) !== - 1 ) { converter = new JunitConverter ( files [ i ] ) ; converter . exec ( converterCallback ) ; } else { try { result = JSON . parse ( fs . readFileSync ( files [ i ] ) ) ; } catch ( err ) { console . log ( 'Error parsing JSON of ' + files [ i ] ) ; result = { } ; } } response = mergeResults ( result , response ) ; count ++ ; } return Q . fcall ( function ( ) { return response ; } ) ; }
Get tht results from a glob and merges the results into a single object
Get tht results from a glob and merges the results into a single object