-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
misc(build): create error-y LHR for the deploy #9283
Conversation
11bc9cd
to
efd41c9
Compare
@connorjclark this one doesn't add any |
|
a classic |
We can just throw any string into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-Authored-By: Patrick Hulce <[email protected]>
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
yup. just wanted something realistic. ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it could be pretty fragile. What do you think about checking in error artifacts? If the pageLoadError-defaultPass
trace and devtoolsLog are deleted, they should be quite small.
@@ -220,6 +220,8 @@ class PerformanceCategoryRenderer extends CategoryRenderer { | |||
element.appendChild(groupEl); | |||
} | |||
|
|||
// TODO: Handle passed w/ warnings in a unique clump like non-perf categories do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is chicken nuggets an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ayup #9288
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete then? it doesn't really have anything to do with this PR and is redundant with that PR
|
||
/** | ||
* Generate an LHR with errors for the renderer to display | ||
* We'll write an "empty" artifacts file to disk, only to use it in auditMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs periods
}, | ||
}; | ||
// @ts-ignore driver isn't mocked out completely | ||
const artifacts = await GatherRunner.initializeBaseArtifacts(options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One downside here is that ts-ignore is going to make this invisible to any breaking changes made to initializeBaseArtifacts, and since it's an internal method that could pretty easily happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about throwing a ts-ignore/cast on the driver object instead?
mkdirp(TMP); | ||
fs.writeFileSync(`${TMP}/artifacts.json`, JSON.stringify(artifacts), 'utf-8'); | ||
const errorRunnerResult = await lighthouse(url, {auditMode: TMP}); | ||
const errorLhr = /** @type {LH.RunnerResult} */ (errorRunnerResult).lhr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need a cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because lighthouse
can return RunnerResult | undefined
(i think because of -G?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because lighthouse can return RunnerResult | undefined (i think because of -G?)
ah, oh right. I prefer the real undefined check over the cast personally, but not a big deal in this case
I was thinking that (and i've done something like that locally for months) but calling Not sure if you were suggesting it, but also adding that reverse engineering how to structure artifacts to get these warnings also is not fun. |
@@ -220,6 +220,8 @@ class PerformanceCategoryRenderer extends CategoryRenderer { | |||
element.appendChild(groupEl); | |||
} | |||
|
|||
// TODO: Handle passed w/ warnings in a unique clump like non-perf categories do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete then? it doesn't really have anything to do with this PR and is redundant with that PR
mkdirp(TMP); | ||
fs.writeFileSync(`${TMP}/artifacts.json`, JSON.stringify(artifacts), 'utf-8'); | ||
const errorRunnerResult = await lighthouse(url, {auditMode: TMP}); | ||
const errorLhr = /** @type {LH.RunnerResult} */ (errorRunnerResult).lhr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because lighthouse can return RunnerResult | undefined (i think because of -G?)
ah, oh right. I prefer the real undefined check over the cast personally, but not a big deal in this case
const artifacts = await GatherRunner.initializeBaseArtifacts(options); | ||
// Add in a global runWarning | ||
artifacts.LighthouseRunWarnings.push(`Something went wrong with recording the trace over your | ||
page load. Please run Lighthouse again. (NO_FCP)`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about checking in error artifacts? If the pageLoadError-defaultPass trace and devtoolsLog are deleted, they should be quite small.
could just replace all of the above with
/** @type {LH.BaseArtifacts} */
const artifacts = {
fetchTime: '2019-06-26T23:56:58.381Z',
LighthouseRunWarnings: [
`Something went wrong with recording the trace over your page load. Please run Lighthouse again. (NO_FCP)`, // eslint-disable-line max-len
],
TestedAsMobileDevice: true,
HostUserAgent: 'Mozilla/5.0 ErrorUserAgent Chrome/66',
NetworkUserAgent: 'Mozilla/5.0 ErrorUserAgent Chrome/66',
BenchmarkIndex: 1000,
WebAppManifest: null,
Stacks: [],
settings: defaultSettings,
URL: {
requestedUrl: 'http://fakeurl.com',
finalUrl: 'http://fakeurl.com',
},
Timing: [],
PageLoadError: null,
devtoolsLogs: {},
traces: {},
};
and then continue as below. Only a little bit longer and the type assertion keeps everything in sync.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM
will aid in looking at some of @connorjclark's recent PRs.