diff --git a/lighthouse-core/config/config.js b/lighthouse-core/config/config.js index 40651ccbda6a..9de9ab95309e 100644 --- a/lighthouse-core/config/config.js +++ b/lighthouse-core/config/config.js @@ -63,10 +63,15 @@ function validateCategories(categories, audits, groups) { } const auditImpl = audit.implementation; - if (categoryId === 'accessibility' && !auditRef.group && !auditImpl.meta.manual) { + const isManual = auditImpl.meta.scoreDisplayMode === 'manual'; + if (categoryId === 'accessibility' && !auditRef.group && !isManual) { throw new Error(`${auditRef.id} accessibility audit does not have a group`); } + if (auditRef.weight > 0 && isManual) { + throw new Error(`${auditRef.id} is manual but has a positive weight`); + } + if (auditRef.group && !groups[auditRef.group]) { throw new Error(`${auditRef.id} references unknown group ${auditRef.group}`); } diff --git a/lighthouse-core/test/config/config-test.js b/lighthouse-core/test/config/config-test.js index 156509a144f0..15f2fb775522 100644 --- a/lighthouse-core/test/config/config-test.js +++ b/lighthouse-core/test/config/config-test.js @@ -271,6 +271,19 @@ describe('Config', () => { }), /unknown group missing-group/); }); + it('throws when a manual audit has weight', () => { + return assert.throws(_ => new Config({ + audits: ['manual/pwa-cross-browser'], + categories: { + accessibility: { + audits: [ + {id: 'pwa-cross-browser', weight: 10}, + ], + }, + }, + }), /cross-browser .*has a positive weight/); + }); + it('filters the config', () => { const config = new Config({ settings: {