👷 Load BrowserStack credentials from .env file#4189
Merged
thomas-lebeau merged 1 commit intomainfrom Feb 17, 2026
Merged
Conversation
- Add --env-file-if-exists=.env to test:unit:bs and test:e2e:bs scripts - Gitignore .env files to prevent accidental credential leaks - Add .env.example to document expected environment variables
BeltranBulbarellaDD
approved these changes
Feb 17, 2026
rgaignault
approved these changes
Feb 17, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation
BrowserStack credentials (
BS_USERNAMEandBS_ACCESS_KEY) currently need to be manually exported as environment variables before running BS tests. This is error-prone and credentials can accidentally end up in shell history.Changes
--env-file-if-exists=.envflag totest:unit:bsandtest:e2e:bsscripts so Node.js automatically loads variables from a.envfile when present.env*to.gitignore(with!.env.exampleexception) to prevent credential leaks.env.exampledocumenting the expected variablesThis is fully opt-in — exporting env vars manually as before still works. The
.envfile is only loaded if it exists (--env-file-if-exists).1Password Environments
For a more secure setup, you can use 1Password Environments to manage the
.envfile. 1Password can mount the file on the filesystem on demand and will ask for permission beforeTest instructions
.envfile at the repo root with your BrowserStack credentials:yarn test:unit:bsoryarn test:e2e:bs— credentials should be loaded automatically.envfile is not tracked by git (git statusshould not show it)Checklist