This commit is contained in:
soulgalore 2014-08-15 09:14:35 +02:00
parent 1f0758e35e
commit 8898b271bb
4 changed files with 28 additions and 18 deletions

View File

@ -11,7 +11,7 @@ var assets = {};
exports.processPage = function(pageData) {
if (pageData.yslow) {
pageData.yslow.comps.forEach(function(comp) {
if (comp.type != "doc") {
if (comp.type !== 'doc') {
var url = comp.url;
var asset = assets[url];
@ -39,7 +39,7 @@ exports.generateResults = function() {
});
return {
id: "assets",
id: 'assets',
list: values
};
};

View File

@ -20,16 +20,18 @@ config = require('nomnom').options({
metavar: '<FILE>',
help: 'The path to a plain text file with one URL on each row. Each line must end with a new line in the file.',
callback: function(file) {
if (!fs.existsSync(file))
if (!fs.existsSync(file)) {
return 'Could not find the file:' + file;
}
}
},
sites: {
metavar: '<FILE>',
help: 'The path to a plain text file with one URL on each row. Each line must end with a new line in the file.',
callback: function(file) {
if (!fs.existsSync(file))
if (!fs.existsSync(file)) {
return 'Couldnt find the file:' + file;
}
}
},
version: {
@ -161,10 +163,12 @@ config = require('nomnom').options({
default: 3,
help: 'The number of times you should test each URL when fetching timing metrics. Default is three times',
callback: function(n) {
if (n !== parseInt(n))
if (n !== parseInt(n)) {
return 'You must specify an integer';
else if (parseInt(n) <= 0)
}
else if (parseInt(n) <= 0) {
return 'You must specify a positive integer';
}
}
},
screenshot: {

View File

@ -265,11 +265,12 @@ module.exports.registerHelpers = function registerHelpers() {
var itemsLastRow = size % perRow;
// TODO make this generic, now it's hardcoded to 3 per row
if(size - index <= itemsLastRow) {
if (itemsLastRow === 2)
if (size - index <= itemsLastRow) {
if (itemsLastRow === 2) {
return 6;
else
} else {
return 12;
}
}
return 4;

View File

@ -10,8 +10,6 @@ var builder = require('xmlbuilder'),
path = require('path'),
util = require('./util');
module.exports = JUnitRenderer;
function JUnitRenderer(collector) {
this.collector = collector;
this.ruleTestsuites = builder.create('testsuites', {
@ -80,9 +78,8 @@ function generateBrowserTimeTestSuitePerPage(browserTimeData, timingTestsuites)
}
function generateTimingTestCase(stats, timing, run, testsuite, limit) {
var browser = run.pageData.browserName,
version = run.pageData.browserVersion,
url = run.pageData.url;
var browser = run.pageData.browserName;
var version = run.pageData.browserVersion;
// The time in Jenkins needs to be in seconds
var testCase = testsuite.ele('testcase', {
@ -170,10 +167,15 @@ function generateRuleTestSuitePerPage(url, score, rules, ruleDictionary,
function isFailure(ruleid, value) {
if (config.thresholds) {
if (config.thresholds.hasOwnProperty(ruleid))
if (config.thresholds.hasOwnProperty(ruleid)) {
return (value < config.thresholds[ruleid]);
else return (value < config.threshold);
} else return (value < config.threshold);
}
else {
return (value < config.threshold);
}
} else {
return (value < config.threshold);
}
}
JUnitRenderer.prototype.renderAfterFullAnalyse = function(cb) {
@ -197,6 +199,9 @@ JUnitRenderer.prototype.renderAfterFullAnalyse = function(cb) {
};
function renderXMLFile(xml, fileName) {
console.log("Writing " + fileName);
console.log('Writing ' + fileName);
fs.outputFileSync(path.join(config.run.absResultDir,fileName), xml);
}
module.exports = JUnitRenderer;