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

clients: Output setting is always an array #6403

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion clients/extension/scripts/extension-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function updateBadgeUI(optUrl) {
async function runLighthouseInExtension(flags, categoryIDs) {
// Default to 'info' logging level.
flags.logLevel = flags.logLevel || 'info';
flags.output = 'html';
flags.output = ['html'];

const connection = new ExtensionProtocol();
const url = await connection.getCurrentTabURL();
Expand Down
2 changes: 1 addition & 1 deletion clients/lightrider-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function runLighthouseInLR(connection, url, flags, {lrDevice, categoryIDs,
}

// pre process the LHR for proto
if (flags.output === 'json' && typeof results.report === 'string') {
if (flags.output === ['json'] && typeof results.report === 'string') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

unfortunately this doesn't work, the equality operator here is checking references not value.

> const array = ['json'];
< undefined
> ['json'] === array
< false
> ['json'] == array
< false

will need to be more explicit

flags.output && flags.output.length === 1 && flags.output[0] === 'json'

Copy link
Member Author

Choose a reason for hiding this comment

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

#saving me from myself

return preprocessor.processForProto(results.report);
}

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const throttling = {

/** @type {LH.Config.Settings} */
const defaultSettings = {
output: 'json',
output: ['json'],
maxWaitForLoad: 45 * 1000,
throttlingMethod: 'simulate',
throttling: throttling.mobileSlow4G,
Expand Down
2 changes: 1 addition & 1 deletion typings/externs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ declare global {
*/
interface SharedFlagsSettings {
// The output types (json, html, ...)
output?: OutputMode|OutputMode[];
output?: OutputMode[];
// The locale setting
locale?: Locale;
// The maximum amount of time to wait for a page to load in ms
Expand Down