ackama / lighthouse-matchers

Provides RSpec matchers for executing and evaluating Google Chrome Lighthouse audit scores
MIT License
14 stars 1 forks source link

Fixes #15: Only run audits for the categories that are requested #28

Closed joshmcarthur closed 1 year ago

joshmcarthur commented 2 years ago

This pull request adds a CLI argument so that only the requested category of audits are checked (terminology note: we've misnamed our own 'audit' variable - it should properly be 'category', since in LH a category is made up of many audits, an audit being a single check. This speeds up LH runs significantly, since before this patch, all audits are run, and we pluck out the category result we want.

With this change, we only run the category we're interested in (e.g. "performance"), and then pluck out the result. This means this change is backwards compatible!

This PR also has prompted me to realise another enhancement I can add - the ability to pass more than one audit to a spec. This would mean that we can do multiple checks on the same page in a single LH run - in some examples that spring to mind, this would save up to 30s per page tested for some applications.