@@ -20,17 +20,7 @@ export async function initDebugClient(
2020 file : path . join ( testDataPath , 'web/index.html' )
2121 } ;
2222
23- if ( process . env [ 'FIREFOX_EXECUTABLE' ] ) {
24- launchArgs . firefoxExecutable = process . env [ 'FIREFOX_EXECUTABLE' ] ;
25- }
26-
27- if ( process . env [ 'FIREFOX_PROFILE' ] ) {
28- launchArgs . profile = process . env [ 'FIREFOX_PROFILE' ] ;
29- }
30-
31- if ( process . env [ 'HEADLESS' ] === "true" ) {
32- launchArgs . firefoxArgs = [ "-headless" ] ;
33- }
23+ processEnvironmentVariables ( launchArgs ) ;
3424
3525 if ( extraLaunchArgs !== undefined ) {
3626 launchArgs = Object . assign ( launchArgs , extraLaunchArgs ) ;
@@ -77,17 +67,7 @@ export async function initDebugClientForAddon(
7767 dcArgs . file = path . join ( testDataPath , `webExtension/index.html` ) ;
7868 }
7969
80- if ( process . env [ 'FIREFOX_EXECUTABLE' ] ) {
81- dcArgs . firefoxExecutable = process . env [ 'FIREFOX_EXECUTABLE' ] ;
82- }
83-
84- if ( process . env [ 'FIREFOX_PROFILE' ] ) {
85- dcArgs . profile = process . env [ 'FIREFOX_PROFILE' ] ;
86- }
87-
88- if ( process . env [ 'HEADLESS' ] === "true" ) {
89- dcArgs . firefoxArgs = [ "-headless" ] ;
90- }
70+ processEnvironmentVariables ( dcArgs ) ;
9171
9272 let dc = new DebugClient ( 'node' , './dist/adapter.bundle.js' , 'firefox' ) ;
9373
@@ -113,6 +93,28 @@ export async function initDebugClientForAddon(
11393 return dc ;
11494}
11595
96+ function processEnvironmentVariables ( launchArgs : LaunchConfiguration ) {
97+ if ( process . env [ 'FIREFOX_EXECUTABLE' ] ) {
98+ launchArgs . firefoxExecutable = process . env [ 'FIREFOX_EXECUTABLE' ] ;
99+ }
100+
101+ if ( process . env [ 'FIREFOX_PROFILE' ] ) {
102+ launchArgs . profile = process . env [ 'FIREFOX_PROFILE' ] ;
103+ }
104+
105+ if ( process . env [ 'FIREFOX_PROFILE_DIR' ] ) {
106+ launchArgs . profileDir = process . env [ 'FIREFOX_PROFILE_DIR' ] ;
107+ }
108+
109+ if ( process . env [ 'KEEP_PROFILE_CHANGES' ] === 'true' ) {
110+ launchArgs . keepProfileChanges = true ;
111+ }
112+
113+ if ( process . env [ 'HEADLESS' ] === 'true' ) {
114+ launchArgs . firefoxArgs = [ '-headless' ] ;
115+ }
116+ }
117+
116118async function waitForUnoccupiedPort ( port : number , timeout : number ) {
117119 if ( ! await isPortOccupied ( port ) ) {
118120 return ;
0 commit comments