11'use strict' ;
22
3- const opn = require ( 'opn ' ) ;
3+ const open = require ( 'open ' ) ;
44const runOpen = require ( '../../../lib/utils/runOpen' ) ;
55
6- jest . mock ( 'opn ' ) ;
6+ jest . mock ( 'open ' ) ;
77
88describe ( 'runOpen util' , ( ) => {
99 afterEach ( ( ) => {
10- opn . mockClear ( ) ;
10+ open . mockClear ( ) ;
1111 } ) ;
1212
1313 describe ( 'should open browser' , ( ) => {
1414 beforeEach ( ( ) => {
15- opn . mockImplementation ( ( ) => Promise . resolve ( ) ) ;
15+ open . mockImplementation ( ( ) => Promise . resolve ( ) ) ;
1616 } ) ;
1717
1818 it ( 'on specify URL' , ( ) => {
1919 return runOpen ( 'https://example.com' , { } , console ) . then ( ( ) => {
20- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
20+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
2121 Array [
2222 "https://example.com",
2323 Object {
@@ -34,7 +34,7 @@ describe('runOpen util', () => {
3434 { openPage : '/index.html' } ,
3535 console
3636 ) . then ( ( ) => {
37- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
37+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
3838 Array [
3939 "https://example.com/index.html",
4040 Object {
@@ -72,7 +72,7 @@ describe('runOpen util', () => {
7272 { open : 'Google Chrome' } ,
7373 console
7474 ) . then ( ( ) => {
75- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
75+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
7676 Array [
7777 "https://example.com",
7878 Object {
@@ -90,7 +90,7 @@ describe('runOpen util', () => {
9090 { open : 'Google Chrome' , openPage : '/index.html' } ,
9191 console
9292 ) . then ( ( ) => {
93- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
93+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
9494 Array [
9595 "https://example.com/index.html",
9696 Object {
@@ -171,7 +171,7 @@ describe('runOpen util', () => {
171171 const logMock = { warn : jest . fn ( ) } ;
172172
173173 beforeEach ( ( ) => {
174- opn . mockImplementation ( ( ) => Promise . reject ( ) ) ;
174+ open . mockImplementation ( ( ) => Promise . reject ( ) ) ;
175175 } ) ;
176176
177177 afterEach ( ( ) => {
@@ -183,7 +183,7 @@ describe('runOpen util', () => {
183183 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
184184 `"Unable to open \\"https://example.com\\" in browser. If you are running in a headless environment, please do not use the --open flag"`
185185 ) ;
186- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
186+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
187187 Array [
188188 "https://example.com",
189189 Object {
@@ -203,7 +203,7 @@ describe('runOpen util', () => {
203203 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
204204 `"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"`
205205 ) ;
206- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
206+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
207207 Array [
208208 "https://example.com/index.html",
209209 Object {
@@ -223,7 +223,7 @@ describe('runOpen util', () => {
223223 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
224224 `"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"`
225225 ) ;
226- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
226+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
227227 Array [
228228 "https://example.com",
229229 Object {
@@ -244,7 +244,7 @@ describe('runOpen util', () => {
244244 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
245245 `"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"`
246246 ) ;
247- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
247+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
248248 Array [
249249 "https://example.com/index.html",
250250 Object {
0 commit comments