diff --git a/lighthouse-cli/test/smokehouse/pwa-config.js b/lighthouse-cli/test/smokehouse/pwa-config.js index 752e40f31752..a08be3fd2d1f 100644 --- a/lighthouse-cli/test/smokehouse/pwa-config.js +++ b/lighthouse-cli/test/smokehouse/pwa-config.js @@ -38,6 +38,7 @@ module.exports = { ] }, { + passName: 'domstats', gatherers: [ 'dobetterweb/domstats', 'http-redirect' diff --git a/lighthouse-core/config/config.js b/lighthouse-core/config/config.js index 6a9d8cdc983d..f0049b29769f 100644 --- a/lighthouse-core/config/config.js +++ b/lighthouse-core/config/config.js @@ -129,13 +129,12 @@ function validatePasses(passes, audits, rootPath) { }); }); - // Passes should have unique passName's. Warn otherwise. + // Passes should have unique `passName`s. Warn otherwise. const usedNames = new Set(); - passes.forEach((pass, index) => { + passes.forEach(pass => { const passName = pass.passName || Audit.DEFAULT_PASS; if (usedNames.has(passName)) { - log.warn('config', `passes[${index}] may overwrite trace ` + - ` of earlier pass without a unique passName (repeated name: ${passName}.`); + throw new Error(`Passes must have unique names (repeated passName: ${passName}.`); } usedNames.add(passName); }); diff --git a/lighthouse-core/config/plots.json b/lighthouse-core/config/plots.json index c5739b869ad4..66bb042c0081 100644 --- a/lighthouse-core/config/plots.json +++ b/lighthouse-core/config/plots.json @@ -1,6 +1,5 @@ { "passes": [{ - "recordNetwork": true, "recordTrace": true, "pauseBeforeTraceEndMs": 5000, "useThrottling": true, diff --git a/lighthouse-core/gather/gather-runner.js b/lighthouse-core/gather/gather-runner.js index 3e9b9b6949af..5d2b4c948e2d 100644 --- a/lighthouse-core/gather/gather-runner.js +++ b/lighthouse-core/gather/gather-runner.js @@ -85,7 +85,7 @@ class GatherRunner { return Promise.resolve() // Begin tracing only if requested by config. .then(_ => options.config.recordTrace && driver.beginTrace(options.flags)) - // Network is always recorded for internal use, even if not saved as artifact. + // Network is always recorded for gatherer use .then(_ => driver.beginNetworkCollect(options)) // Navigate. .then(_ => driver.gotoURL(options.url, { @@ -238,7 +238,6 @@ class GatherRunner { // an object with a traceEvents property. Normalize to object form. passData.trace = Array.isArray(traceContents) ? {traceEvents: traceContents} : traceContents; - passData.devtoolsLog = driver.devtoolsLog; log.verbose('statusEnd', 'Retrieving trace'); }); } @@ -249,7 +248,7 @@ class GatherRunner { return driver.endNetworkCollect(); }).then(networkRecords => { GatherRunner.assertPageLoaded(options.url, driver, networkRecords); - // expose devtoolsLog & networkRecords to gatherers + // Expose devtoolsLog & networkRecords to gatherers passData.devtoolsLog = driver.devtoolsLog; passData.networkRecords = networkRecords; log.verbose('statusEnd', status); @@ -351,8 +350,7 @@ class GatherRunner { .then(_ => GatherRunner.pass(runOptions, gathererResults)) .then(_ => GatherRunner.afterPass(runOptions, gathererResults)) .then(passData => { - // If requested by config, merge trace and network data for this - // pass into tracingData. + // If requested by config, merge trace -> tracingData const passName = config.passName || Audit.DEFAULT_PASS; if (config.recordTrace) { tracingData.traces[passName] = passData.trace; diff --git a/lighthouse-core/test/config/config-test.js b/lighthouse-core/test/config/config-test.js index 2d0905cd16b5..266187814baf 100644 --- a/lighthouse-core/test/config/config-test.js +++ b/lighthouse-core/test/config/config-test.js @@ -82,21 +82,7 @@ describe('Config', () => { audits: [] }; - return new Promise((resolve, reject) => { - const warningListener = function(args) { - const warningMsg = args[1]; - const isMatch = new RegExp(`overwrite.+${unlikelyPassName}`).test(warningMsg); - if (isMatch) { - log.events.removeListener('warning', warningListener); - resolve(); - } else { - reject(isMatch); - } - }; - log.events.addListener('warning', warningListener); - - const _ = new Config(configJson); - }); + assert.throws(_ => new Config(configJson), /unique/); }); it('warns when traced twice with no passNames specified', () => { @@ -109,18 +95,7 @@ describe('Config', () => { audits: [] }; - return new Promise((resolve, reject) => { - const warningListener = function(args) { - const warningMsg = args[1]; - if (new RegExp(`overwrite.+${Audit.DEFAULT_PASS}`).test(warningMsg)) { - log.events.removeListener('warning', warningListener); - resolve(); - } - }; - log.events.addListener('warning', warningListener); - - const _ = new Config(configJson); - }); + assert.throws(_ => new Config(configJson), /unique/); }); it('throws for unknown gatherers', () => { @@ -298,7 +273,7 @@ describe('Config', () => { }, passes: [ {recordTrace: true, gatherers: []}, - {gatherers: ['accessibility']}, + {passName: 'a11y', gatherers: ['accessibility']}, ], audits: [ 'accessibility/color-contrast',