Skip to content

Commit

Permalink
core(fr): clone default categories to avoid modification (#13337)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny authored Nov 10, 2021
1 parent 8b0a047 commit 993fbc9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lighthouse-core/fraggle-rock/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'use strict';

const legacyDefaultConfig = require('../../config/default-config.js');
const {deepClone} = require('../../config/config-helpers.js');

/** @type {LH.Config.AuditJson[]} */
const frAudits = [
Expand All @@ -22,7 +23,8 @@ const frCategoryAuditRefExtensions = {
/** @return {LH.Config.Json['categories']} */
function mergeCategories() {
if (!legacyDefaultConfig.categories) return {};
const categories = legacyDefaultConfig.categories;
// Don't modify original default config.
const categories = deepClone(legacyDefaultConfig.categories);
for (const key of Object.keys(frCategoryAuditRefExtensions)) {
if (!categories[key]) continue;
categories[key].auditRefs.push(...frCategoryAuditRefExtensions[key]);
Expand Down

0 comments on commit 993fbc9

Please sign in to comment.