Skip to content

Commit 531f0bf

Browse files
gkalpakAndrewKushnir
authored andcommitted
ci: improve error message when payload size check fails (angular#41116)
Previously, when a payload size check failed, the error message prompted the user to update the size limits using a CI-specific file path, which was confusing (esp. for external contributors). See, for example, https://circleci.com/gh/angular/angular/932733. This commit improves the error message by printing the file path relative to the repository root instead. PR Close angular#41116
1 parent c1a93fc commit 531f0bf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/ci/payload-size.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Imports
1212
const fs = require('fs');
13+
const path = require('path');
1314

1415
// Get branch and project name from command line arguments.
1516
const [, , limitFile, project, branch, commit] = process.argv;
@@ -68,8 +69,10 @@ for (const compressionType in limitSizes) {
6869
successMessages.concat(failureMessages).forEach(message => console.error(message));
6970

7071
if (failed) {
72+
const projectRoot = path.resolve(__dirname, '../..');
73+
const limitFileRelPath = path.relative(projectRoot, limitFile);
7174
console.info(
72-
`If this is a desired change, please update the size limits in file '${limitFile}'.`);
75+
`If this is a desired change, please update the size limits in file '${limitFileRelPath}'.`);
7376
process.exit(1);
7477
} else {
7578
console.info(`Payload size check passed. All diffs are less than 1% or 500 bytes.`);

0 commit comments

Comments
 (0)