feat(testing): support browser executable path detection via environm…#6308
Merged
christian-bromann merged 5 commits intomainfrom Jun 23, 2025
Merged
Conversation
3 tasks
|
testing of the fix |
…ent variables Add fallback chain for browser executable path using PUPPETEER_EXECUTABLE_PATH and CHROME_PATH environment variables, improving automatic browser detection for Puppeteer-based testing.
d039229 to
b968e1d
Compare
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.
What is the current behavior?
GitHub Issue Number: #6213
The
PUPPETEER_EXECUTABLE_PATHenvironment 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.browserExecutablePathbut 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
browserExecutablePathproperty 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.browserExecutablePathhas been updated to reflect the new default behavior and fallback chain.Does this introduce a breaking change?
This change is backward compatible. The
browserExecutablePathconfiguration option still works as before, but now users have additional options through environment variables when this config is not explicitly set.Testing
browserExecutablePathconfiguration still worksPUPPETEER_EXECUTABLE_PATHtakes precedenceCHROME_PATHis used whenPUPPETEER_EXECUTABLE_PATHis not setOther information
This addresses the regression introduced in recent versions where
PUPPETEER_EXECUTABLE_PATHstopped 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.