Skip to content

Commit

Permalink
tests(smoke): check runner result is sensible before using
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Sep 1, 2022
1 parent bb2bed6 commit 7decdca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cli/test/smokehouse/report-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,6 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
* @param {*} obj
*/
function failsChromeVersionCheck(obj) {
// LHR never actually run, so we can't know. Better to not prune
// things than to fail loudly when accessing lhr.environment.
if (!lhr.environment) return false;

return !chromiumVersionCheck({
version: getChromeVersionString(),
min: obj._minChromiumVersion,
Expand Down
7 changes: 7 additions & 0 deletions cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ async function runSmokeTest(smokeTestDefn, testOptions) {
...await lighthouseRunner(requestedUrl, configJson, {isDebug, useLegacyNavigation}),
networkRequests: takeNetworkRequestUrls ? takeNetworkRequestUrls() : undefined,
};

if (!result || !result.lhr?.audits || !result.artifacts) {
// Don't try again–something went really wrong! ex: the config could not be resolved
i = retries + 1;
throw new Error('lighthouse runner returned a bad result. got lhr:\n' +
JSON.stringify(result.lhr, null, 2));
}
} catch (e) {
// Clear the network requests so that when we retry, we don't see duplicates.
if (takeNetworkRequestUrls) takeNetworkRequestUrls();
Expand Down

0 comments on commit 7decdca

Please sign in to comment.