Skip to content

Commit 41fafef

Browse files
committed
Print tunnel identifier for BrowserStack
1 parent ba8f7e0 commit 41fafef

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

scripts/browserstack/start-tunnel.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ unzip -q ${TUNNEL_FILE} -d browserstack-tunnel
3030
# Cleanup the download directory.
3131
rm ${TUNNEL_FILE}
3232

33-
ARGS=""
33+
if [ -z "${TRAVIS_JOB_ID}" ]; then
34+
echo "Error: Cannot set up a BrowserStack tunnel if there is no '\$TRAVIS_JOB_ID' set."
35+
exit 1
36+
fi;
3437

35-
# Set tunnel-id only on Travis, to make local testing easier.
36-
if [ ! -z "${TRAVIS_JOB_ID}" ]; then
37-
ARGS="${ARGS} --local-identifier ${TRAVIS_JOB_ID}"
38-
fi
38+
ARGS="--local-identifier ${TRAVIS_JOB_ID}"
3939

40-
echo "Starting Browserstack Local in the background, logging into: ${TUNNEL_LOG}"
40+
echo "Starting Browserstack Local in the background, logging into: ${TUNNEL_LOG}." \
41+
"Using the following tunnel identifier: ${TRAVIS_JOB_ID}"
4142

4243
# Extension to the BrowserStackLocal binaries, because those can't create a readyfile.
4344
function create_ready_file {

test/karma.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ module.exports = (config) => {
9999

100100
if (process.env['TRAVIS']) {
101101
const buildId = `TRAVIS #${process.env.TRAVIS_BUILD_NUMBER} (${process.env.TRAVIS_BUILD_ID})`;
102+
const tunnelIdentifier = process.env.TRAVIS_JOB_ID;
102103

103104
if (process.env['TRAVIS_PULL_REQUEST'] === 'false'
104105
&& process.env['MODE'] === "test-travis-1") {
@@ -115,7 +116,8 @@ module.exports = (config) => {
115116

116117
if (platform === 'browserstack') {
117118
config.browserStack.build = buildId;
118-
config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_ID;
119+
config.browserStack.tunnelIdentifier = tunnelIdentifier;
120+
console.log(`Setting up Browserstack launcher. Connecting to tunnel: "${tunnelIdentifier}"`);
119121
} else if (platform !== 'travis') {
120122
throw new Error(`Platform "${platform}" is unknown. Exiting..`);
121123
}

0 commit comments

Comments
 (0)