customConfig support for browser config changes#66
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Notes: Custom Browser Arguments Configuration
Overview
Added support for customizing Puppeteer browser launch arguments through the same configuration system used for Lighthouse settings. Users can now specify different browser arguments for headless and headful modes via customConfig.json.
Changes Made
1. New File: configLoader.js
loadCustomConfig()- Loads custom config from filegetBrowserArgsFromCustomConfig(isHeadless)- Gets browser args based on modegetLighthouseConfigByBrowserType(browserType)- Gets merged lighthouse configcreateBaseLighthouseConfig(device)- Creates base lighthouse config2. Updated: browser.js
#getArgs(isHeadless)to fetch args from config with fallback to defaults3. Updated: lighthouse.js
getLighthouseConfigByBrowserTypefrom configLoader asgetConfigByBrowserType4. Updated: browser.js
getLighthouseConfigByBrowserTypefrom configLoader5. Updated: customConfig.json
browserArgssection with support for:headless- Arguments for headless mode (--headless=true)headful- Arguments for headful/headed mode (--headless=false)6. Updated: README.md
browserArgsdocumentation with examples--configFile=customConfig.jsonUsage
Basic Example
Custom Browser Args in customConfig.json
{ "settings": { "browserArgs": { "headless": [ "--allow-no-sandbox-job", "--no-sandbox", "--disable-gpu" ], "headful": [ "--allow-no-sandbox-job", "--no-sandbox" ] } } }Key Features
✅ Config-Driven - Browser args defined in same config file as Lighthouse settings
✅ Mode-Specific - Different args for headless vs headful modes
✅ Backward Compatible - Falls back to defaults if no config provided
✅ Centralized - Single configLoader.js manages all configuration
✅ Consistent - Same pattern as existing Lighthouse config loading
Architecture
Backward Compatibility
Testing Recommendations
--configFileparameter--headless=true) uses correct args--headless=false) uses correct args