File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,17 @@ for (const key of BROWSERSTACK_LOCAL_OPTION_KEYS) {
30
30
}
31
31
}
32
32
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
+ */
33
37
export class Config {
34
38
constructor (
35
39
public readonly browserstackUsername : string ,
36
40
public readonly browserstackAccessKey : string ,
37
41
public readonly DEV_MODE : boolean ,
38
42
public readonly browserstackLocalOptions : Record < string , any > ,
43
+ public readonly USE_OWN_LOCAL_BINARY_PROCESS : boolean ,
39
44
) { }
40
45
}
41
46
@@ -44,6 +49,7 @@ const config = new Config(
44
49
process . env . BROWSERSTACK_ACCESS_KEY ! ,
45
50
process . env . DEV_MODE === "true" ,
46
51
browserstackLocalOptions ,
52
+ process . env . USE_OWN_LOCAL_BINARY_PROCESS === "true" ,
47
53
) ;
48
54
49
55
export default config ;
Original file line number Diff line number Diff line change @@ -80,6 +80,24 @@ export async function ensureLocalBinarySetup(
80
80
"Ensuring local binary setup as it is required for private URLs..." ,
81
81
) ;
82
82
83
+ if ( config . USE_OWN_LOCAL_BINARY_PROCESS ) {
84
+ logger . info (
85
+ "Using user's own BrowserStack Local binary process, checking if it's running..." ,
86
+ ) ;
87
+
88
+ const isRunning = await isBrowserStackLocalRunning ( ) ;
89
+ if ( ! isRunning ) {
90
+ throw new Error (
91
+ "USE_OWN_LOCAL_BINARY_PROCESS is enabled but BrowserStack Local process is not running. Please start your BrowserStack Local binary process first." ,
92
+ ) ;
93
+ }
94
+
95
+ logger . info (
96
+ "BrowserStack Local process is running, proceeding with user's own process." ,
97
+ ) ;
98
+ return ;
99
+ }
100
+
83
101
const localBinary = new Local ( ) ;
84
102
await killExistingBrowserStackLocalProcesses ( ) ;
85
103
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ export class AccessibilityScanner {
35
35
const localHosts = new Set ( [ "127.0.0.1" , "localhost" , "0.0.0.0" ] ) ;
36
36
const BS_LOCAL_DOMAIN = "bs-local.com" ;
37
37
38
+ if ( config . USE_OWN_LOCAL_BINARY_PROCESS && hasLocal ) {
39
+ throw new Error (
40
+ "Cannot start scan with local URLs when using own BrowserStack Local binary process. Please set USE_OWN_LOCAL_BINARY_PROCESS to false." ,
41
+ ) ;
42
+ }
43
+
38
44
if ( hasLocal ) {
39
45
await ensureLocalBinarySetup ( localIdentifier ) ;
40
46
} else {
You can’t perform that action at this time.
0 commit comments