test: cover bundle-size-summary.js and fail loudly on missing entrypoints

Addresses review feedback: validate every tracked entrypoint is present
in stats.json (fail instead of silently skipping) and add unit tests
for the summary script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rusackas
2026-07-28 03:03:44 -07:00
parent 2908d630f9
commit dacaa4fec6
2 changed files with 116 additions and 2 deletions

View File

@@ -59,7 +59,10 @@ function main() {
const results = [];
TRACKED_ENTRYPOINTS.forEach(name => {
const entrypoint = entrypoints[name];
if (!entrypoint) return;
if (!entrypoint) {
console.error(`stats.json is missing the "${name}" entrypoint`);
process.exit(1);
}
results.push({
name: `${name} entrypoint (JS)`,
unit: 'bytes',
@@ -75,4 +78,8 @@ function main() {
console.log(JSON.stringify(results, null, 2));
}
main();
if (require.main === module) {
main();
}
module.exports = { entrypointSizeByExt, main, TRACKED_ENTRYPOINTS };