Skip to content

Commit

Permalink
plots: tell user first run is being discarded (#2232)
Browse files Browse the repository at this point in the history
also fix eslint ignores
  • Loading branch information
paulirish authored May 11, 2017
1 parent 7d7bac6 commit b44b174
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plots/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
'use strict';

/* eslint-disable no-console */

const path = require('path');
const parseURL = require('url').parse;

Expand Down Expand Up @@ -125,8 +127,8 @@ const URLS = [
*/
function main() {
if (utils.isDir(constants.OUT_PATH)) {
console.log('ERROR: Found output from previous run at: ', constants.OUT_PATH); // eslint-disable-line no-console
console.log('Please run: npm run clean'); // eslint-disable-line no-console
console.log('ERROR: Found output from previous run at: ', constants.OUT_PATH);
console.log('Please run: npm run clean');
return;
}

Expand All @@ -140,7 +142,7 @@ function main() {
() => {
throw err;
},
console.error // eslint-disable-line no-console
console.error
));
}

Expand Down Expand Up @@ -177,7 +179,7 @@ function runAnalysis() {
* @return {!Promise}
*/
function singleRunAnalysis(url, id, {ignoreRun}) {
console.log('Measuring site:', url, 'run:', id); // eslint-disable-line no-console
console.log('Measuring site:', url, 'run:', id);
const parsedURL = parseURL(url);
const urlBasedFilename = sanitizeURL(`${parsedURL.host}-${parsedURL.pathname}`);
const runPath = path.resolve(constants.OUT_PATH, urlBasedFilename, id);
Expand All @@ -203,6 +205,7 @@ function analyzeWithLighthouse(url, outputPath, assetsPath, {ignoreRun}) {
return lighthouse(url, flags, config)
.then(lighthouseResults => {
if (ignoreRun) {
console.log('First load of site. Results not being saved to disk.');
return;
}
return assetSaver
Expand All @@ -212,7 +215,7 @@ function analyzeWithLighthouse(url, outputPath, assetsPath, {ignoreRun}) {
return Printer.write(lighthouseResults, flags.output, outputPath);
});
})
.catch(err => console.error(err)); // eslint-disable-line no-console
.catch(err => console.error(err));
}

/**
Expand Down

0 comments on commit b44b174

Please sign in to comment.