If a browsertime marks a test as a failure, exit with error code (#4047)

This commit is contained in:
Peter Hedenskog 2024-01-05 16:54:34 +01:00 committed by GitHub
parent 569a400219
commit e0832c5723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -148,6 +148,14 @@ async function start() {
execSync('xdg-open ' + result.localPath + '/index.html');
}
// If one of the URLs is marked as a failure in Browsertime
// then set the exit code
for (let bt of result.browsertime) {
if (bt.markedAsFailure === 1) {
process.exitCode = 1;
}
}
if (
parsed.options.budget &&
Object.keys(result.budgetResult.failing).length > 0

View File

@ -364,6 +364,8 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
run.extras = result[resultIndex].extras[runIndex];
}
run.markedAsFailure = result[resultIndex].markedAsFailure;
if (
result[resultIndex].cdp &&
result[resultIndex].cdp.performance