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

cli(lighthouse): Add --mixed-content flag for triggering the mixed content audit #4441

Merged
merged 7 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 5 additions & 4 deletions lighthouse-cli/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function getFlags(manualArgv) {

.group(
[
'save-assets', 'list-all-audits', 'list-trace-categories',
'additional-trace-categories', 'config-path', 'chrome-flags', 'perf', 'port',
'hostname', 'max-wait-for-load', 'enable-error-reporting', 'gather-mode', 'audit-mode',
'save-assets', 'list-all-audits', 'list-trace-categories', 'additional-trace-categories',
'config-path', 'mixed-content', 'chrome-flags', 'perf', 'port', 'hostname',
'max-wait-for-load', 'enable-error-reporting', 'gather-mode', 'audit-mode',
],
'Configuration:')
.describe({
Expand All @@ -81,6 +81,7 @@ function getFlags(manualArgv) {
'additional-trace-categories':
'Additional categories to capture with the trace (comma-delimited).',
'config-path': 'The path to the config JSON.',
'mixed-content': 'Use the mixed-content auditing config.',
'chrome-flags':
`Custom flags to pass to Chrome (space-delimited). For a full list of flags, see http://bit.ly/chrome-flags
Additionally, use the CHROME_PATH environment variable to use a specific Chrome binary. Requires Chromium version 54.0 or later. If omitted, any detected Chrome Canary or Chrome stable will be used.`,
Expand Down Expand Up @@ -110,7 +111,7 @@ function getFlags(manualArgv) {
'disable-storage-reset', 'disable-device-emulation', 'disable-cpu-throttling',
'disable-network-throttling', 'save-assets', 'list-all-audits',
'list-trace-categories', 'perf', 'view', 'verbose', 'quiet', 'help',
'gather-mode', 'audit-mode',
'gather-mode', 'audit-mode', 'mixed-content',
])
.choices('output', printer.getValidOutputOptions())
// force as an array
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function lighthouse(url, flags = {}, configJSON) {
log.setLevel(flags.logLevel);

// Use ConfigParser to generate a valid config file
const config = new Config(configJSON, flags.configPath);

const config = flags.mixedContent ? new Config(require('./config/mixed-content.js'), null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about we handle this over in bin.js where we handle --perf :)

} else if (cliFlags.perf) {
config = /** @type {!LH.Config} */ (perfOnlyConfig);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. That's a better place than the awkward ternary I came up with.

: new Config(configJSON, flags.configPath);
const connection = new ChromeProtocol(flags.port, flags.hostname);

// kick off a lighthouse run
Expand Down