Skip to content

Commit

Permalink
core: remove NO_ERROR runtimeError when no error (#7358)
Browse files Browse the repository at this point in the history
  • Loading branch information
exterkamp authored and brendankenny committed Mar 5, 2019
1 parent 8db87bf commit ffc430d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
7 changes: 2 additions & 5 deletions lighthouse-core/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class Runner {
/**
* Returns first runtimeError found in artifacts.
* @param {LH.Artifacts} artifacts
* @return {LH.Result['runtimeError']}
* @return {LH.Result['runtimeError']|undefined}
*/
static getArtifactRuntimeError(artifacts) {
for (const possibleErrorArtifact of Object.values(artifacts)) {
Expand All @@ -345,10 +345,7 @@ class Runner {
}
}

return {
code: LHError.NO_ERROR,
message: '',
};
return undefined;
}

/**
Expand Down
4 changes: 0 additions & 4 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"requestedUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
"finalUrl": "http://localhost:10200/dobetterweb/dbw_tester.html",
"runWarnings": [],
"runtimeError": {
"code": "NO_ERROR",
"message": ""
},
"audits": {
"is-on-https": {
"id": "is-on-https",
Expand Down
15 changes: 15 additions & 0 deletions lighthouse-core/test/runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ describe('Runner', () => {
}
});

it('does not include a top-level runtimeError when gatherers were successful', async () => {
const config = new Config({
settings: {
auditMode: __dirname + '/fixtures/artifacts/perflog/',

},
audits: [
'content-width',
],
});

const {lhr} = await Runner.run(undefined, {config});
assert.strictEqual(lhr.runtimeError, undefined);
});

it('-GA is a normal run but it saves artifacts to disk', () => {
const settings = {auditMode: artifactsPath, gatherMode: artifactsPath};
const opts = {url, config: generateConfig(settings), driverMock};
Expand Down
2 changes: 1 addition & 1 deletion types/lhr.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ declare global {
/** List of top-level warnings for this Lighthouse run. */
runWarnings: string[];
/** A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. */
runtimeError: {code: string, message: string};
runtimeError?: {code: string, message: string};
/** The User-Agent string of the browser used run Lighthouse for these results. */
userAgent: string;
/** Information about the environment in which Lighthouse was run. */
Expand Down

0 comments on commit ffc430d

Please sign in to comment.