Skip to content

Commit

Permalink
If a browsertime marks a test as a failure, exit with error code (#4047)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Jan 5, 2024
1 parent 569a400 commit e0832c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/sitespeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/plugins/browsertime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e0832c5

Please sign in to comment.