Skip to content

Commit

Permalink
misc(errors-in-console): warn on use of unrecognized audit options (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce authored and brendankenny committed Oct 15, 2019
1 parent 5cc3990 commit 2a3cc4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lighthouse-core/audits/errors-in-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* This is done by collecting Chrome console log messages and filtering out the non-error ones.
*/

const log = require('lighthouse-logger');
const Audit = require('./audit.js');
const i18n = require('../lib/i18n/i18n.js');

Expand Down Expand Up @@ -57,7 +58,9 @@ class ErrorLogs extends Audit {
* @return {Array<T>}
*/
static filterAccordingToOptions(items, options) {
const {ignoredPatterns} = options;
const {ignoredPatterns, ...restOfOptions} = options;
const otherOptionKeys = Object.keys(restOfOptions);
if (otherOptionKeys.length) log.warn(this.meta.id, 'Unrecognized options', otherOptionKeys);
if (!ignoredPatterns) return items;

return items.filter(({description}) => {
Expand Down

0 comments on commit 2a3cc4c

Please sign in to comment.