From 8305e50f8e6cdeb96b226b4c00d086fa4bc647a3 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 7 May 2024 10:18:35 +0000 Subject: [PATCH] build: trigger error when size-tracking is enabled but not in limit file (#55708) Trigger an error when attempting to enable size-tracking for a project not listed in the integration-payload.json file. Before this update, size-checks would succeed even if the project wasn't included in the file size limit. PR Close #55708 --- integration/platform-server/BUILD.bazel | 5 ----- scripts/ci/payload-size.js | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/integration/platform-server/BUILD.bazel b/integration/platform-server/BUILD.bazel index dda388951a4..45298ffe014 100644 --- a/integration/platform-server/BUILD.bazel +++ b/integration/platform-server/BUILD.bazel @@ -3,9 +3,4 @@ load("//integration:index.bzl", "ng_integration_test") ng_integration_test( name = "test", setup_chromium = True, - track_payload_paths = [ - "/standalone/browser", - "/ngmodule/browser", - ], - track_payload_size = "platform-server", ) diff --git a/scripts/ci/payload-size.js b/scripts/ci/payload-size.js index b36e5331c13..1f12f620097 100644 --- a/scripts/ci/payload-size.js +++ b/scripts/ci/payload-size.js @@ -22,6 +22,9 @@ const THRESHOLD_PERCENT = 5; const currentSizes = JSON.parse(fs.readFileSync('/tmp/current.log', 'utf8')); const allLimitSizes = JSON.parse(fs.readFileSync(limitFile, 'utf8')); const limitSizes = allLimitSizes[project]; +if (!limitSizes) { + throw new Error(`ERROR: Project '${project}' is missing from limit file ${limitFile}.`); +} // Check current sizes against limits. let failed = false;