Skip to content

Commit

Permalink
tests: add timeout to runSmokeTest (#16017)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed May 24, 2024
1 parent df56548 commit c73113d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,18 @@ async function runSmokeTest(smokeTestDefn, testOptions) {

// Run Lighthouse.
try {
// Each individual runner has internal timeouts, but we've had bugs where
// that didn't cover some edge case. So to be safe give a (long) timeout here.
const timeoutPromise = new Promise((_, reject) => {
setTimeout(() =>
reject(new Error('Timed out waiting for provided lighthouseRunner')), 1000 * 120);
});
const timedResult = await Promise.race([
lighthouseRunner(requestedUrl, config, testRunnerOptions),
timeoutPromise,
]);
result = {
...await lighthouseRunner(requestedUrl, config, testRunnerOptions),
...timedResult,
networkRequests: takeNetworkRequestUrls ? takeNetworkRequestUrls() : undefined,
};

Expand Down

0 comments on commit c73113d

Please sign in to comment.