function getAuditIdsInCategories(allCategories, onlyCategories) {
  if (!allCategories) return new Set();

  onlyCategories = onlyCategories || Object.keys(allCategories);
  const categories = onlyCategories.map(categoryId => allCategories[categoryId]);
  const auditRefs = categories.flatMap(category => category?.auditRefs || []);
  return new Set(auditRefs.map(auditRef => auditRef.id));
}
Returns the set of audit IDs used in the list of categories.
If `onlyCategories` is not set, this function returns the list of all audit IDs across all
categories.

@param {LH.Config.ResolvedConfig['categories']} allCategories
@param {string[] | undefined} onlyCategories
@return {Set<string>}