@@ -17,6 +17,8 @@ describe('runOpen util', () => {
1717
1818 it ( 'on specify URL' , ( ) => {
1919 return runOpen ( 'https://example.com' , { } , console ) . then ( ( ) => {
20+ expect ( opn ) . toBeCalledWith ( 'https://example.com' , { wait : false } ) ;
21+
2022 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
2123 Array [
2224 "https://example.com",
@@ -34,6 +36,10 @@ describe('runOpen util', () => {
3436 { openPage : '/index.html' } ,
3537 console
3638 ) . then ( ( ) => {
39+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
40+ wait : false ,
41+ } ) ;
42+
3743 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
3844 Array [
3945 "https://example.com/index.html",
@@ -51,6 +57,10 @@ describe('runOpen util', () => {
5157 { openPage : [ '/index.html' ] } ,
5258 console
5359 ) . then ( ( ) => {
60+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
61+ wait : false ,
62+ } ) ;
63+
5464 expect ( opn . mock . calls [ 0 ] ) . toMatchSnapshot ( ) ;
5565 } ) ;
5666 } ) ;
@@ -61,6 +71,13 @@ describe('runOpen util', () => {
6171 { openPage : [ '/index.html' , '/index2.html' ] } ,
6272 console
6373 ) . then ( ( ) => {
74+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
75+ wait : false ,
76+ } ) ;
77+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index2.html' , {
78+ wait : false ,
79+ } ) ;
80+
6481 expect ( opn . mock . calls [ 0 ] ) . toMatchSnapshot ( ) ;
6582 expect ( opn . mock . calls [ 1 ] ) . toMatchSnapshot ( ) ;
6683 } ) ;
@@ -72,6 +89,11 @@ describe('runOpen util', () => {
7289 { open : 'Google Chrome' } ,
7390 console
7491 ) . then ( ( ) => {
92+ expect ( opn ) . toBeCalledWith ( 'https://example.com' , {
93+ app : 'Google Chrome' ,
94+ wait : false ,
95+ } ) ;
96+
7597 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
7698 Array [
7799 "https://example.com",
@@ -90,6 +112,11 @@ describe('runOpen util', () => {
90112 { open : 'Google Chrome' , openPage : '/index.html' } ,
91113 console
92114 ) . then ( ( ) => {
115+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
116+ app : 'Google Chrome' ,
117+ wait : false ,
118+ } ) ;
119+
93120 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
94121 Array [
95122 "https://example.com/index.html",
@@ -108,6 +135,11 @@ describe('runOpen util', () => {
108135 { open : 'Google Chrome' , openPage : 'https://example2.com' } ,
109136 console
110137 ) . then ( ( ) => {
138+ expect ( opn ) . toBeCalledWith ( 'https://example2.com' , {
139+ app : 'Google Chrome' ,
140+ wait : false ,
141+ } ) ;
142+
111143 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
112144 Array [
113145 "https://example2.com",
@@ -126,6 +158,10 @@ describe('runOpen util', () => {
126158 { open : 'Google Chrome' , openPage : 'http://example2.com' } ,
127159 console
128160 ) . then ( ( ) => {
161+ expect ( opn ) . toBeCalledWith ( 'http://example2.com' , {
162+ app : 'Google Chrome' ,
163+ wait : false ,
164+ } ) ;
129165 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
130166 Array [
131167 "http://example2.com",
@@ -148,6 +184,14 @@ describe('runOpen util', () => {
148184 } ,
149185 console
150186 ) . then ( ( ) => {
187+ expect ( opn ) . toBeCalledWith ( 'https://example2.com' , {
188+ app : 'Google Chrome' ,
189+ wait : false ,
190+ } ) ;
191+ expect ( opn ) . toBeCalledWith ( 'https://example3.com' , {
192+ app : 'Google Chrome' ,
193+ wait : false ,
194+ } ) ;
151195 expect ( opn . mock . calls [ 0 ] ) . toMatchSnapshot ( ) ;
152196 expect ( opn . mock . calls [ 1 ] ) . toMatchSnapshot ( ) ;
153197 } ) ;
@@ -162,6 +206,15 @@ describe('runOpen util', () => {
162206 } ,
163207 console
164208 ) . then ( ( ) => {
209+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
210+ app : 'Google Chrome' ,
211+ wait : false ,
212+ } ) ;
213+ expect ( opn ) . toBeCalledWith ( 'https://example2.com' , {
214+ app : 'Google Chrome' ,
215+ wait : false ,
216+ } ) ;
217+
165218 expect ( opn . mock . calls [ 0 ] ) . toMatchSnapshot ( ) ;
166219 expect ( opn . mock . calls [ 1 ] ) . toMatchSnapshot ( ) ;
167220 } ) ;
@@ -183,6 +236,8 @@ describe('runOpen util', () => {
183236 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
184237 `"Unable to open \\"https://example.com\\" in browser. If you are running in a headless environment, please do not use the --open flag"`
185238 ) ;
239+ expect ( opn ) . toBeCalledWith ( 'https://example.com' , { wait : false } ) ;
240+
186241 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
187242 Array [
188243 "https://example.com",
@@ -203,6 +258,10 @@ describe('runOpen util', () => {
203258 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
204259 `"Unable to open \\"https://example.com/index.html\\" in browser. If you are running in a headless environment, please do not use the --open flag"`
205260 ) ;
261+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
262+ wait : false ,
263+ } ) ;
264+
206265 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
207266 Array [
208267 "https://example.com/index.html",
@@ -223,6 +282,11 @@ describe('runOpen util', () => {
223282 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
224283 `"Unable to open \\"https://example.com\\" in browser: \\"Google Chrome\\". If you are running in a headless environment, please do not use the --open flag"`
225284 ) ;
285+ expect ( opn ) . toBeCalledWith ( 'https://example.com' , {
286+ app : 'Google Chrome' ,
287+ wait : false ,
288+ } ) ;
289+
226290 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
227291 Array [
228292 "https://example.com",
@@ -244,6 +308,11 @@ describe('runOpen util', () => {
244308 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
245309 `"Unable to open \\"https://example.com/index.html\\" in browser: \\"Google Chrome\\". If you are running in a headless environment, please do not use the --open flag"`
246310 ) ;
311+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
312+ app : 'Google Chrome' ,
313+ wait : false ,
314+ } ) ;
315+
247316 expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
248317 Array [
249318 "https://example.com/index.html",
@@ -255,5 +324,32 @@ describe('runOpen util', () => {
255324 ` ) ;
256325 } ) ;
257326 } ) ;
327+
328+ it ( 'on specify URL with page in Google Chrome incognito mode and log error ' , ( ) => {
329+ return runOpen (
330+ 'https://example.com' ,
331+ {
332+ open : { app : [ 'Google Chrome' , '--incognito' ] } ,
333+ openPage : '/index.html' ,
334+ } ,
335+ logMock
336+ ) . then ( ( ) => {
337+ expect ( opn ) . toBeCalledWith ( 'https://example.com/index.html' , {
338+ app : [ 'Google Chrome' , '--incognito' ] ,
339+ } ) ;
340+
341+ expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
342+ Array [
343+ "https://example.com/index.html",
344+ Object {
345+ "app": Array [
346+ "Google Chrome",
347+ "--incognito",
348+ ],
349+ },
350+ ]
351+ ` ) ;
352+ } ) ;
353+ } ) ;
258354 } ) ;
259355} ) ;
0 commit comments