@@ -25,6 +25,7 @@ describe('Options', () => {
2525 describe ( 'extensionDir' , ( ) => {
2626 it ( 'should default to the current working directory' , async ( ) => {
2727 const actual = await resolveRunOptions ( { } ) ;
28+
2829 expect ( actual ) . toMatchObject < Partial < ResolvedRunOptions > > ( {
2930 extensionDir : process . cwd ( ) ,
3031 } ) ;
@@ -34,40 +35,50 @@ describe('Options', () => {
3435 const actual = await resolveRunOptions ( {
3536 extensionDir : './path/to/extension' ,
3637 } ) ;
38+
3739 expect ( actual ) . toMatchObject < Partial < ResolvedRunOptions > > ( {
3840 extensionDir : resolve ( process . cwd ( ) , './path/to/extension' ) ,
3941 } ) ;
4042 } ) ;
43+
44+ it ( 'should use absolute paths as-is' , async ( ) => {
45+ const actual = await resolveRunOptions ( {
46+ extensionDir : '/abs/path/to/extension2' ,
47+ } ) ;
48+
49+ expect ( actual ) . toMatchObject < Partial < ResolvedRunOptions > > ( {
50+ extensionDir : resolve ( '/abs/path/to/extension2' ) ,
51+ } ) ;
52+ } ) ;
4153 } ) ;
4254
4355 describe ( 'target' , ( ) => {
4456 it ( 'should be "chrome" by default' , async ( ) => {
45- const actual = await resolveRunOptions ( {
46- extensionDir : 'path/to/extension' ,
47- } ) ;
57+ const actual = await resolveRunOptions ( { } ) ;
58+
4859 expect ( actual ) . toMatchObject < Partial < ResolvedRunOptions > > ( {
4960 target : 'chrome' ,
5061 } ) ;
5162 } ) ;
5263
5364 it ( 'should be what is passed in' , async ( ) => {
5465 const actual = await resolveRunOptions ( {
55- extensionDir : 'path/to/extension' ,
5666 target : 'custom' ,
5767 browserBinaries : {
5868 custom : '/path/to/custom/browser' ,
5969 } ,
6070 } ) ;
71+
6172 expect ( actual ) . toMatchObject < Partial < ResolvedRunOptions > > ( {
6273 target : 'custom' ,
6374 } ) ;
6475 } ) ;
6576
6677 it ( 'should throw an error if the target binary could not be found' , async ( ) => {
6778 const actual = resolveRunOptions ( {
68- extensionDir : 'path/to/extension' ,
6979 target : 'custom' ,
7080 } ) ;
81+
7182 await expect ( actual ) . rejects . toThrow ( 'Could not find "custom" binary.' ) ;
7283 } ) ;
7384 } ) ;
@@ -83,7 +94,6 @@ describe('Options', () => {
8394 ? 'C:\\path\\to\\custom\\browser.exe'
8495 : path ;
8596 const actual = await resolveRunOptions ( {
86- extensionDir : 'path/to/extension' ,
8797 target : 'custom' ,
8898 browserBinaries : {
8999 custom : path ,
@@ -98,9 +108,11 @@ describe('Options', () => {
98108 describe ( 'chromiumArgs' , ( ) => {
99109 it ( 'should log a warning when --user-data-dir is passed in' , async ( ) => {
100110 const warnSpy = vi . spyOn ( console , 'warn' ) ;
111+
101112 await resolveRunOptions ( {
102113 chromiumArgs : [ '--user-data-dir=some/custom/path' ] ,
103114 } ) ;
115+
104116 expect ( warnSpy ) . toBeCalledTimes ( 1 ) ;
105117 expect ( warnSpy ) . toHaveBeenCalledWith (
106118 expect . stringContaining (
@@ -111,9 +123,11 @@ describe('Options', () => {
111123
112124 it ( 'should log a warning when --remote-debugging-port is passed in' , async ( ) => {
113125 const warnSpy = vi . spyOn ( console , 'warn' ) ;
126+
114127 await resolveRunOptions ( {
115128 chromiumArgs : [ '--remote-debugging-port=9222' ] ,
116129 } ) ;
130+
117131 expect ( warnSpy ) . toBeCalledTimes ( 1 ) ;
118132 expect ( warnSpy ) . toHaveBeenCalledWith (
119133 expect . stringContaining (
@@ -126,6 +140,7 @@ describe('Options', () => {
126140 const actual = await resolveRunOptions ( {
127141 chromiumArgs : [ '--window-size=1920,1080' ] ,
128142 } ) ;
143+
129144 expect ( actual . chromiumArgs ) . toEqual ( [
130145 // Defaults
131146 '--disable-features=Translate,OptimizationHints,MediaRouter,DialMediaRouteProvider,CalculateNativeWinOcclusion,InterestFeedContentSuggestions,CertificateTransparencyComponentUpdater,AutofillServerCommunication,PrivacySandboxSettings4' ,
@@ -161,9 +176,11 @@ describe('Options', () => {
161176 describe ( 'firefoxArgs' , ( ) => {
162177 it ( 'should log a warning when --profile is passed in' , async ( ) => {
163178 const warnSpy = vi . spyOn ( console , 'warn' ) ;
179+
164180 await resolveRunOptions ( {
165181 firefoxArgs : [ '--profile=some/custom/path' ] ,
166182 } ) ;
183+
167184 expect ( warnSpy ) . toBeCalledTimes ( 1 ) ;
168185 expect ( warnSpy ) . toHaveBeenCalledWith (
169186 expect . stringContaining ( 'Custom Firefox --profile argument ignored' ) ,
@@ -172,9 +189,11 @@ describe('Options', () => {
172189
173190 it ( 'should log a warning when --remote-debugging-port is passed in' , async ( ) => {
174191 const warnSpy = vi . spyOn ( console , 'warn' ) ;
192+
175193 await resolveRunOptions ( {
176194 firefoxArgs : [ '--remote-debugging-port=9222' ] ,
177195 } ) ;
196+
178197 expect ( warnSpy ) . toBeCalledTimes ( 1 ) ;
179198 expect ( warnSpy ) . toHaveBeenCalledWith (
180199 expect . stringContaining (
@@ -187,6 +206,7 @@ describe('Options', () => {
187206 const actual = await resolveRunOptions ( {
188207 firefoxArgs : [ '--window-size=1920,1080' ] ,
189208 } ) ;
209+
190210 expect ( actual . firefoxArgs ) . toEqual ( [
191211 // Defaults
192212 '--new-instance' ,
0 commit comments