-
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): add basic timespan support #11944
Conversation
lighthouse-core/runner.js
Outdated
@@ -26,8 +26,9 @@ const LHError = require('./lib/lh-error.js'); | |||
|
|||
class Runner { | |||
/** | |||
* @param {(runnerData: {requestedUrl: string, config: Config, driverMock?: Driver}) => Promise<LH.Artifacts>} gatherFn | |||
* @param {{config: Config, url?: string, driverMock?: Driver}} runOpts | |||
* @template {LH.Config.Config | LH.Config.FRConfig} TConfig |
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.
is this just some code golf?
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 wouldn't be very good at it if it were ;)
this is replacing Config
type requirement with TConfig
which can be either the legacy or new fraggle rock config, it doesn't care which one so long as they match
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.
from how I understand TS they wouldn't have to match, am I missing something that @template does?
(oh, seems you reverted changes to this file, ok)
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.
they're not reverted, just part of the filtering changes #11941 that disappeared after I fixed some merge conflicts :)
from how I understand TS they wouldn't have to match, am I missing something that @template does?
I think so :)
In my understanding @template {Bar} TFoo
~= <TFoo extends Bar>
. Once a invocation parameter constrains the type of TConfig to FRConfig, the other parameter must also be constrained because they're the same type.
@@ -5,76 +5,10 @@ | |||
*/ | |||
'use strict'; | |||
|
|||
const Driver = require('./gather/driver.js'); |
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 just a move, no logic changes here
* @param {LH.Gatherer.GatherMode} mode | ||
* @return {LH.Config.FRConfig['artifacts']} | ||
*/ | ||
function filterArtifactsByGatherMode(artifacts, mode) { |
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 new, but covered by #11941 and not really part of this PR
* @param {LH.Config.FRConfig} config | ||
* @return {LH.BaseArtifacts} | ||
*/ | ||
function getBaseArtifacts(config) { |
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 just moved, nothing special here
*/ | ||
'use strict'; | ||
|
||
const Driver = require('./driver.js'); |
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 just moved, no logic changes here
* @param {{page: import('puppeteer').Page, config?: LH.Config.Json}} options | ||
* @return {Promise<{endTimespan(): Promise<LH.RunnerResult|undefined>}>} | ||
*/ | ||
async function startTimespan(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.
this is new and the bulk of the logic to review
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!
85f9dd3
to
f39985e
Compare
Summary
Adds basic timespan support to the Fraggle Rock API.
api.js
intosnapshot-runner.js
/base-artifacts.js
.timespan-runner.js
.beforeTimespan
/afterTimespan
methods.ConsoleMessages
gatherer to support Fraggle Rock (easiest and highest impact timespan-only gatherer).Related Issues/PRs
ref #11313
loosely dependent on #11941 (though could be rebased against master if really necessary)