Skip to content

Commit 29ff405

Browse files
committed
chore: binary zip name in constant
1 parent b40c46c commit 29ff405

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

setup-local/config/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ module.exports = {
5555

5656
LOCAL_BINARY_FOLDER: 'LocalBinaryFolder',
5757
LOCAL_BINARY_NAME: 'BrowserStackLocal',
58+
LOCAL_BINARY_ZIP: 'binaryZip',
5859
LOCAL_LOG_FILE_PREFIX: 'BrowserStackLocal',
5960
};

setup-local/dist/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ const {
10801080
LOCAL_BINARY_FOLDER,
10811081
PLATFORMS,
10821082
LOCAL_BINARY_NAME,
1083+
LOCAL_BINARY_ZIP,
10831084
LOCAL_LOG_FILE_PREFIX,
10841085
LOCAL_BINARY_TRIGGER,
10851086
BINARY_MAX_TRIES,
@@ -1214,7 +1215,7 @@ class BinaryControl {
12141215
}
12151216

12161217
async _removeAnyStaleBinary() {
1217-
const binaryZip = path.resolve(this.binaryFolder, 'binaryZip');
1218+
const binaryZip = path.resolve(this.binaryFolder, LOCAL_BINARY_ZIP);
12181219
const previousLocalBinary = path.resolve(
12191220
this.binaryFolder,
12201221
`${LOCAL_BINARY_NAME}${this.platform === PLATFORMS.WIN32 ? '.exe' : ''}`,
@@ -1241,7 +1242,10 @@ class BinaryControl {
12411242
this._removeAnyStaleBinary();
12421243

12431244
core.info('Downloading BrowserStackLocal binary...');
1244-
const downloadPath = await tc.downloadTool(this.binaryLink, path.resolve(this.binaryFolder, 'binaryZip'));
1245+
const downloadPath = await tc.downloadTool(
1246+
this.binaryLink,
1247+
path.resolve(this.binaryFolder, LOCAL_BINARY_ZIP),
1248+
);
12451249
const extractedPath = await tc.extractZip(downloadPath, this.binaryFolder);
12461250
core.info(`BrowserStackLocal binary downloaded & extracted successfuly at: ${extractedPath}`);
12471251
const cachedPath = await tc.cacheDir(extractedPath, LOCAL_BINARY_NAME, '1.0.0');
@@ -13491,6 +13495,7 @@ module.exports = {
1349113495

1349213496
LOCAL_BINARY_FOLDER: 'LocalBinaryFolder',
1349313497
LOCAL_BINARY_NAME: 'BrowserStackLocal',
13498+
LOCAL_BINARY_ZIP: 'binaryZip',
1349413499
LOCAL_LOG_FILE_PREFIX: 'BrowserStackLocal',
1349513500
};
1349613501

setup-local/src/binaryControl.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const {
1515
LOCAL_BINARY_FOLDER,
1616
PLATFORMS,
1717
LOCAL_BINARY_NAME,
18+
LOCAL_BINARY_ZIP,
1819
LOCAL_LOG_FILE_PREFIX,
1920
LOCAL_BINARY_TRIGGER,
2021
BINARY_MAX_TRIES,
@@ -149,7 +150,7 @@ class BinaryControl {
149150
}
150151

151152
async _removeAnyStaleBinary() {
152-
const binaryZip = path.resolve(this.binaryFolder, 'binaryZip');
153+
const binaryZip = path.resolve(this.binaryFolder, LOCAL_BINARY_ZIP);
153154
const previousLocalBinary = path.resolve(
154155
this.binaryFolder,
155156
`${LOCAL_BINARY_NAME}${this.platform === PLATFORMS.WIN32 ? '.exe' : ''}`,
@@ -176,7 +177,10 @@ class BinaryControl {
176177
this._removeAnyStaleBinary();
177178

178179
core.info('Downloading BrowserStackLocal binary...');
179-
const downloadPath = await tc.downloadTool(this.binaryLink, path.resolve(this.binaryFolder, 'binaryZip'));
180+
const downloadPath = await tc.downloadTool(
181+
this.binaryLink,
182+
path.resolve(this.binaryFolder, LOCAL_BINARY_ZIP),
183+
);
180184
const extractedPath = await tc.extractZip(downloadPath, this.binaryFolder);
181185
core.info(`BrowserStackLocal binary downloaded & extracted successfuly at: ${extractedPath}`);
182186
const cachedPath = await tc.cacheDir(extractedPath, LOCAL_BINARY_NAME, '1.0.0');

setup-local/test/binaryControl.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
LOCAL_BINARY_FOLDER,
1919
PLATFORMS,
2020
LOCAL_BINARY_NAME,
21+
LOCAL_BINARY_ZIP,
2122
LOCAL_LOG_FILE_PREFIX,
2223
LOCAL_BINARY_TRIGGER,
2324
ALLOWED_INPUT_VALUES: {
@@ -387,7 +388,7 @@ describe('Binary Control Operations', () => {
387388
it('Delete any stale local binary (non windows)', () => {
388389
binaryControl.platform = PLATFORMS.DARWIN;
389390
binaryControl._removeAnyStaleBinary();
390-
const binaryZipPath = path.resolve(binaryControl.binaryFolder, 'binaryZip');
391+
const binaryZipPath = path.resolve(binaryControl.binaryFolder, LOCAL_BINARY_ZIP);
391392
const staleBinaryPath = path.resolve(
392393
binaryControl.binaryFolder,
393394
`${LOCAL_BINARY_NAME}`,
@@ -399,7 +400,7 @@ describe('Binary Control Operations', () => {
399400
it('Delete any stale local binary (windows)', () => {
400401
binaryControl.platform = PLATFORMS.WIN32;
401402
binaryControl._removeAnyStaleBinary();
402-
const binaryZipPath = path.resolve(binaryControl.binaryFolder, 'binaryZip');
403+
const binaryZipPath = path.resolve(binaryControl.binaryFolder, LOCAL_BINARY_ZIP);
403404
const staleBinaryPath = path.resolve(
404405
binaryControl.binaryFolder,
405406
`${LOCAL_BINARY_NAME}.exe`,

0 commit comments

Comments
 (0)