feat(testing): support browser executable path detection via environm… #6308
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.
What is the current behavior?
GitHub Issue Number: #6213
The
PUPPETEER_EXECUTABLE_PATH
environment variable is not being respected when running Stencil tests with Puppeteer. Users who set this environment variable to specify a custom browser executable (e.g., in Docker environments where Chromium is installed separately) encounter errors because Stencil is not using the specified path.The current implementation only checks
config.testing.browserExecutablePath
but ignores common environment variables that users expect to work with Puppeteer.What is the new behavior?
This PR implements a robust fallback chain for browser executable path detection:
Environment Variables Support: Automatically detects browser executables from:
PUPPETEER_EXECUTABLE_PATH
- Standard Puppeteer environment variableCHROME_PATH
- Common Chrome/Chromium path variablepuppeteer.puppeteerExecutablePath()
if neither is setImproved Documentation: Added comprehensive JSDoc documentation for the
browserExecutablePath
property explaining the new default behavior and fallback chain.Simplified Logic: Removed conditional logic in favor of a unified fallback resolution approach that always provides a value.
This change ensures that users can specify browser executables through environment variables without requiring explicit configuration, which is especially important for CI/CD environments and Docker deployments.
Documentation
The JSDoc documentation for
TestingConfig.browserExecutablePath
has been updated to reflect the new default behavior and fallback chain.Does this introduce a breaking change?
This change is backward compatible. The
browserExecutablePath
configuration option still works as before, but now users have additional options through environment variables when this config is not explicitly set.Testing
browserExecutablePath
configuration still worksPUPPETEER_EXECUTABLE_PATH
takes precedenceCHROME_PATH
is used whenPUPPETEER_EXECUTABLE_PATH
is not setOther information
This addresses the regression introduced in recent versions where
PUPPETEER_EXECUTABLE_PATH
stopped working. The fix ensures that Docker users and CI/CD environments can continue to use this standard environment variable to specify custom browser executables without additional configuration.The implementation follows Puppeteer's own environment variable conventions, making it more intuitive for users already familiar with Puppeteer's behavior.