Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 3, 2018
1 parent 1ec13a4 commit e2ac49c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lighthouse-core/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down
13 changes: 13 additions & 0 deletions lighthouse-core/test/config/config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit e2ac49c

Please sign in to comment.