sitespeed.io/lib/postTasks/renderErrorsHTML.js

32 lines
958 B
JavaScript

/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {
if (config.html) {
var renderData = {
'errors': {
'downloadErrorUrls': result.downloadErrors,
'analysisErrorUrls': result.analysisErrors
},
'totalErrors': Object.keys(result.downloadErrors).length + Object.keys(result.analysisErrors).length,
'config': config,
'numberOfPages': result.numberOfAnalyzedPages,
'pageMeta': {
'title': 'Pages that couldn\'t be analyzed',
'description': 'Here are the pages that couldn\'t be analyzed by sitespeed.io',
'isErrors': true
}
};
render('errors', renderData, config.run.absResultDir, cb);
} else {
cb();
}
};