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

screenEmulation.mobile errors with must be boolean when provided with a boolean #12246

Closed
samos123 opened this issue Mar 15, 2021 · 6 comments · Fixed by #12250
Closed

screenEmulation.mobile errors with must be boolean when provided with a boolean #12246

samos123 opened this issue Mar 15, 2021 · 6 comments · Fixed by #12250
Assignees

Comments

@samos123
Copy link
Contributor

samos123 commented Mar 15, 2021

Steps to reproduce:

  1. Run the following
lighthouse https://www.google.com --chrome-flags="--no-sandbox --headless" --output=json --output-path=stdout --disable-dev-shm-usage --form-factor=desktop --throttling.throughputKbps=1000 --throttling.rttMs=0 --throttling.cpuSlowdownMultiplier=1 --throttling.requestLatencyMs=0 --throttling.downloadThroughputKbps=0 --throttling.uploadThroughputKbps=0 --screenEmulation.width=1350 --screenEmulation.height=940 --screenEmulation.deviceScaleFactor=1 --screenEmulation.mobile=false

Result:

Invalid value: 'screenEmulation.mobile' must be a boolean

Specify --help for available options

I expected it to work.

I read the docs of upgrading to version 7 but I can't figure out how to set the value correctly.

I also tried running without setting mobile = false:

lighthouse https://www.google.com --chrome-flags="--no-sandbox --headless" --output=json --output-path=stdout --disable-dev-shm-usage --form-factor=desktop --throttling.throughputKbps=1000 --throttling.rttMs=0 --throttling.cpuSlowdownMultiplier=1 --throttling.requestLatencyMs=0 --throttling.downloadThroughputKbps=0 --throttling.uploadThroughputKbps=0 --screenEmulation.width=1350 --screenEmulation.height=940 --screenEmulation.deviceScaleFactor=1                               
? We're constantly trying to improve Lighthouse and its reliability.
  Learn more: https://github.com/GoogleChrome/lighthouse/blob/master/docs/error-reporting.md 
  May we anonymously report runtime exceptions to improve the tool over time?  Yes
  ChromeLauncher Waiting for browser. +0ms
  ChromeLauncher Waiting for browser... +2ms
  ChromeLauncher Waiting for browser..... +520ms
  ChromeLauncher Waiting for browser....... +503ms
  ChromeLauncher Waiting for browser.......✓ +3ms
  ChromeLauncher Killing Chrome instance 32 +6ms
Runtime error encountered: Screen emulation mobile setting (true) does not match formFactor setting (desktop). See https://github.com/GoogleChrome/lighthouse/blob/master/docs/emulation.md
Error: Screen emulation mobile setting (true) does not match formFactor setting (desktop). See https://github.com/GoogleChrome/lighthouse/blob/master/docs/emulation.md
    at assertValidSettings (/usr/lib/node_modules/lighthouse/lighthouse-core/config/config-helpers.js:110:13)
    at resolveSettings (/usr/lib/node_modules/lighthouse/lighthouse-core/config/config-helpers.js:327:3)
    at new Config (/usr/lib/node_modules/lighthouse/lighthouse-core/config/config.js:253:22)
    at generateConfig (/usr/lib/node_modules/lighthouse/lighthouse-core/index.js:64:10)
    at lighthouse (/usr/lib/node_modules/lighthouse/lighthouse-core/index.js:43:18)
    at runLighthouse (/usr/lib/node_modules/lighthouse/lighthouse-cli/run.js:224:32)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Environment Information

  • Affected Channels: CLI
  • Lighthouse version: 7.2.0
  • Operating System: Linux running inside docker
@samos123 samos123 changed the title screenEmulation.mobile errors with must be boolean when provided with a boolean... screenEmulation.mobile errors with must be boolean when provided with a boolean Mar 15, 2021
@adamraine
Copy link
Member

This appears to be a bug. Setting screenEmulation.mobile=false passes false as a string not a boolean, but it also doesn't work as a boolean flag.

@samos123
Copy link
Contributor Author

Thanks @adamraine for confirming it's a bug and not my doc reading skills :)

Just for context, this is blocking me from adopting at lighthouse 7.2.0 at https://github.com/websu-io/websu because I was using --emulated-form-factor=desktop previously and seems there is no way to express that through CLI right now? or is there a workaround I can use?

Reference: https://github.com/websu-io/websu/blob/799e10551e12d395760dae558e9c0b5955831b5d/pkg/api/app.go#L236

@adamraine
Copy link
Member

If you just need to test the desktop page, you can use --preset=desktop.

If you need to mess with the exact emulation settings, I would suggest using a custom config like this with --config-path=/path/to/config.js.

@samos123
Copy link
Contributor Author

I assumed I can't use preset because I manually override the throttling settings and looks like preset would cause conflict with throttling settings? The config-path might be a good workaround for now. Thank you!

@brendankenny
Copy link
Member

--no-screenEmulation.mobile can also serve as a workaround for now.

@samos123
Copy link
Contributor Author

That's more than a workaround! That could be the permanent solution. Thank you @brendankenny it's working well with --no-screenEmulation.mobile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants