-
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
core(fr): align navigation-runner with legacy gather-runner #12478
Conversation
5629641
to
8cc3abc
Compare
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 work, very excited to use this!
|
||
const baseArtifacts = await getBaseArtifacts(config, driver); | ||
baseArtifacts.URL.requestedUrl = requestedUrl; | ||
|
||
await prepare.prepareTargetForNavigationMode(driver, config.settings); |
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.
Are we leaving this check out then or is it still TBD?
lighthouse/lighthouse-core/gather/gather-runner.js
Lines 155 to 157 in c12959f
// Assert no service workers are still installed, so we test that they would actually be installed for a new user. | |
// TODO(FR-COMPAT): re-evaluate the necessity of this check | |
await GatherRunner.assertNoSameOriginServiceWorkerClients(session, options.requestedUrl); |
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.
I'm intending on leaving it out as it's unrealistic to enforce in a puppeteer context, but I like leaving the TODO in as a callout. We'll probably end up converting it to a warning when we make a pass over our leftover TODOs soon
log.error('NavigationRunner', localizedMessage, navigationContext.requestedUrl); | ||
|
||
return {artifacts: {}, warnings: [...warnings, pageLoadError.friendlyMessage], pageLoadError}; | ||
} else { |
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.
nit: don't need else
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.
ack
I intentionally added the else
to make explicit the two paths this can take. IMO, without the else
it's very easy to miss the return
and think that the else
bit is executed even in the case of a pageLoadError
. I'm all for the early return pattern to avoid nesting but when it's a one-line and/or early check where the intention is clearer :) Convinced? or still prefer no else
?
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.
I still prefer no else
but I won't die on this hill, it's your choice.
break; | ||
} | ||
|
||
// TODO(FR-COMPAT): merge RunWarnings between navigations |
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's preventing us from doing this now?
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.
PR size, the handling of runwarnings has a small cascade of other changes that already fit in well with the base artifacts cleanup I have left and was planning on putting up today.
it.todo('should reset storage'); | ||
it.todo('should not reset storage when skipped'); |
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.
The reset storage tests seem useful at least.
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.
agreed, but these are all tested in prepare-test.js
now, I put these placeholders here when the runner was first added to capture what gather-runner did at the time, and didn't update as those pieces were stripped out of gather-runner into submodules.
Or were you commenting that an integration test where the preparation module isn't mocked would be preferred?
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.
I was thinking these applied to the code in _cleanup
as well.
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.
Ah gotcha, for _cleanup
! Yes good catch 👍
Co-authored-by: Adam Raine <6752989+adamraine@users.noreply.github.com>
b8325c0
to
b6cec29
Compare
const artifacts = await awaitArtifacts(phaseState.artifactState); | ||
return {artifacts, warnings, pageLoadError: undefined}; | ||
} | ||
} | ||
|
||
/** | ||
* @param {NavigationContext} navigationContext |
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.
@return
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.
|
Summary
Won't work until #12469 is merged, butthis brings fraggle rock up to snuff with gather runner and makes use of all the refactoring over the past month! 🎉Related Issues/PRs
ref #11313