clear number of tested runs and collected data between each run/tested site

This commit is contained in:
soulgalore 2014-08-12 07:52:30 +02:00
parent 9c0b0708d2
commit 054664b602
4 changed files with 23 additions and 0 deletions

View File

@ -78,6 +78,12 @@ Collector.prototype.createAggregates = function() {
return aggregates;
};
Collector.prototype.clear = function() {
collectors.forEach(function(c) {
c.clear();
});
};
Collector.prototype.createCollections = function() {
var collections = {};

View File

@ -43,3 +43,7 @@ exports.generateResults = function() {
list: values
};
};
exports.clear = function() {
assets = {};
};

View File

@ -235,3 +235,7 @@ exports.generateResults = function() {
list: pages
};
};
exports.clear = function() {
pages = [];
};

View File

@ -109,6 +109,7 @@ Runner.prototype._setupConfigurationForSite = function(args, cb) {
"yyyy-mm-dd-HH-MM-ss"), config.urlObject.hostname);
// setup the directories needed
var dataDir = path.join(config.run.absResultDir, config.dataDir);
fs.mkdirs(dataDir, function(err) {
if (err) {
log.log('error', "Couldn't create the data dir:" + dataDir + ' ' + err);
@ -333,6 +334,14 @@ Runner.prototype._createOutput = function (downloadErrors, analysisErrors, callB
}
},
function(err, results) {
// TODO this can be cleaner
// We clear the number of pages tested and
// the collected data, so it is ready for next run
// used when testing multiple sites
self.htmlRenderer.numberOfAnalyzedPages = 0;
self.collector.clear();
if (!err)
log.log('info', "Wrote results to " + config.run.absResultDir);
callBack();