lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

Is there a way to specify a domain as third party so it is excluded?

Open rmaclean-ee opened this issue 4 years ago • 1 comments

The scenario is webpage has content from multiple sources, including CDNs and other sites - when running LHCI against the webpage those external sources are included and it would be good to easily exclude them.

Example: Images come from a CDN and the cache TTL is not controllable, so uses-long-cache-ttl alerts for the images.

I have tried using assertMatrix but that doesn't seem to work for all content types. XHR seem to be ok with this but images, for example, are not possible with that.

rmaclean-ee avatar Jan 07 '21 09:01 rmaclean-ee

Thanks for filing @rmaclean-ee!

The short answer is no, but we're open to the feature request. You can achieve this by blocking the resources entirely though!

Our recommendation for using Lighthouse in CI is to limit the number of live third-party dependencies being used. It's likely the only path to asserting performance metrics reliably without unbearable variance as well. You can achieve this on a page that still references third-party code by using Lighthouse's --blocked-url-patterns (collect.settings.blockedUrlPatterns in your lighthouserc.js).

We'll leave this open to track the concept of a ignoreItemsByUrlRegex: /googleanalytics/ in Lighthouse CI 👍

patrickhulce avatar Jan 07 '21 16:01 patrickhulce