Skip to content

Commit 1798a93

Browse files
feat: add USE_OWN_LOCAL_BINARY_PROCESS option to control local binary usage
1 parent b9c5ba5 commit 1798a93

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ for (const key of BROWSERSTACK_LOCAL_OPTION_KEYS) {
3030
}
3131
}
3232

33+
/**
34+
* USE_OWN_LOCAL_BINARY_PROCESS:
35+
* If true, the system will not start a new local binary process, but will use the user's own process.
36+
*/
3337
export class Config {
3438
constructor(
3539
public readonly browserstackUsername: string,
3640
public readonly browserstackAccessKey: string,
3741
public readonly DEV_MODE: boolean,
3842
public readonly browserstackLocalOptions: Record<string, any>,
43+
public readonly USE_OWN_LOCAL_BINARY_PROCESS: boolean,
3944
) {}
4045
}
4146

@@ -44,6 +49,7 @@ const config = new Config(
4449
process.env.BROWSERSTACK_ACCESS_KEY!,
4550
process.env.DEV_MODE === "true",
4651
browserstackLocalOptions,
52+
process.env.USE_OWN_LOCAL_BINARY_PROCESS === "true",
4753
);
4854

4955
export default config;

src/lib/local.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ export async function ensureLocalBinarySetup(
8080
"Ensuring local binary setup as it is required for private URLs...",
8181
);
8282

83+
if (config.USE_OWN_LOCAL_BINARY_PROCESS) {
84+
logger.info(
85+
"Using user's own BrowserStack Local binary process, skipping setup...",
86+
);
87+
return;
88+
}
89+
8390
const localBinary = new Local();
8491
await killExistingBrowserStackLocalProcesses();
8592

src/tools/accessiblity-utils/scanner.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export class AccessibilityScanner {
4141
await killExistingBrowserStackLocalProcesses();
4242
}
4343

44+
if (config.USE_OWN_LOCAL_BINARY_PROCESS) {
45+
throw new Error(
46+
"Cannot start scan with local URLs when using own BrowserStack Local binary process. Please set USE_OWN_LOCAL_BINARY_PROCESS to false.",
47+
);
48+
}
49+
4450
const transformedUrlList = urlList.map((url) => {
4551
try {
4652
const parsed = new URL(url);

0 commit comments

Comments
 (0)