I'm currently developing a JavaScript application, which is being tested with Karma against browsers on BrowserStack using the karma-browserstack-runner. According to the documentation, the accessKey
and username
should be provided in the karma config file as:
browserStack: {
username: 'jamesbond',
accessKey: '007'
},
since I'll be pushing my karma.conf.js
file to the repository and I obviously do not want to push my keys and username, I need some way to inject the login information without modifying the file, e.g. via. environment variables. Any suggestions?
In the karma-browserstack-runner
repo README.md, the Global Options section states:
username
your BS username (email), you can also use BROWSER_STACK_USERNAME env variable.
accessKey
your BS access key (password), you can also use BROWSER_STACK_ACCESS_KEY env variable.
So you can remove those two properties from your karma configuration file and set these two environment variables in your system. The karma plugin will pick them up in case nothing is defined as username
and accessKey
and use it.