build: error when files specified in payload size limits are missing (#27250)

PR Close #27250
This commit is contained in:
George Kalpakas 2018-11-23 21:08:23 +02:00 committed by Igor Minar
parent 24ebdbd04b
commit 445f7896c1
2 changed files with 9 additions and 3 deletions

View File

@ -4,8 +4,7 @@
"uncompressed": {
"runtime": 3881,
"main": 499953,
"polyfills": 53926,
"prettify": 14917
"polyfills": 53926
}
}
}

View File

@ -21,7 +21,14 @@ for (const compressionType in limitSizes) {
const expectedSize = limitPerFile[filename];
const actualSize = currentSizes[`${compressionType}/${filename}`];
if (Math.abs(actualSize - expectedSize) > expectedSize / 100) {
if (actualSize === undefined) {
failed = true;
// An expected compression type/file combination is missing. Maybe the file was renamed or
// removed. Report it as an error, so the user updates the corresponding limit file.
console.log(
`Commit ${commit} ${compressionType} ${filename} meassurement is missing. ` +
'Maybe the file was renamed or removed.');
} else if (Math.abs(actualSize - expectedSize) > expectedSize / 100) {
failed = true;
// We must also catch when the size is significantly lower than the payload limit, so
// we are forced to update the expected payload number when the payload size reduces.