Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: remove NO_ERROR from default responses #7358

Merged
merged 5 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
}

/**
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