-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
feat: support skipping cache and storage clear #1675
Conversation
lighthouse-cli/bin.ts
Outdated
@@ -65,6 +65,7 @@ const cliFlags = yargs | |||
'port' | |||
], 'Configuration:') | |||
.describe({ | |||
'disable-cache-clearing': 'Disable clearing of cache and storage before the run', |
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.
other name ideas welcome, cache is more specific than what actually happens but is probably more familiar/understandable to users than a generic storage
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.
disable-storage-reset
comes to mind. I actually think being more generic than "cache" is good for the reasons you mention. It applies to all forms of storage on the origin.
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.
will do
}); | ||
}); | ||
|
||
it('does not clear the network cache and origin storage when flag is set', () => { |
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.
...when disable-storage-reset flag is set
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.
done
lighthouse-cli/bin.ts
Outdated
@@ -65,6 +65,7 @@ const cliFlags = yargs | |||
'port' | |||
], 'Configuration:') | |||
.describe({ | |||
'disable-storage-reset': 'Disable clearing of cache and storage before the run', |
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: "Disable clearing the browser cache and other storage APIs before a run"
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.
done
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.
LGTM2
@@ -91,13 +91,14 @@ class GatherRunner { | |||
|
|||
static setupDriver(driver, options) { | |||
log.log('status', 'Initializing…'); | |||
const resetStorage = !(options.flags && options.flags.disableStorageReset); |
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 options.flags
ever not defined here? If so, the options.flags.blockedUrlPatterns
line below is in trouble
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.
oh yeah it probably always is, just was jumping around to other places where that wasn't true. i'll update
calledDisableNetworkCache: false, | ||
calledClearStorage: false, | ||
}; | ||
const createCheck = variable => () => { |
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.
it would be nice to replace fake-driver with a nice interface around something like this :)
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.
or we could use sinon
:)
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.
yeah, I'd be fine with that too.
Honestly I hate these tests involving the driver. Rely too much on knowledge of internal implementation instead of externally observable behavior. If we're going to assume the driver calls made and the order they're made in, I'd rather we just setup a debugger protocol record/replay system :)
fixes #1664