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 {
@@ -51,7 +51,7 @@ describe('runOpen util', () => {
5151 { open : 'Google Chrome' } ,
5252 console
5353 ) . then ( ( ) => {
54- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
54+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
5555 Array [
5656 "https://example.com",
5757 Object {
@@ -69,7 +69,7 @@ describe('runOpen util', () => {
6969 { open : 'Google Chrome' , openPage : '/index.html' } ,
7070 console
7171 ) . then ( ( ) => {
72- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
72+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
7373 Array [
7474 "https://example.com/index.html",
7575 Object {
@@ -86,7 +86,7 @@ describe('runOpen util', () => {
8686 const logMock = { warn : jest . fn ( ) } ;
8787
8888 beforeEach ( ( ) => {
89- opn . mockImplementation ( ( ) => Promise . reject ( ) ) ;
89+ open . mockImplementation ( ( ) => Promise . reject ( ) ) ;
9090 } ) ;
9191
9292 afterEach ( ( ) => {
@@ -98,7 +98,7 @@ describe('runOpen util', () => {
9898 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
9999 `"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
100100 ) ;
101- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
101+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
102102 Array [
103103 "https://example.com",
104104 Object {
@@ -118,7 +118,7 @@ describe('runOpen util', () => {
118118 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
119119 `"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
120120 ) ;
121- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
121+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
122122 Array [
123123 "https://example.com/index.html",
124124 Object {
@@ -138,7 +138,7 @@ describe('runOpen util', () => {
138138 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
139139 `"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
140140 ) ;
141- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
141+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
142142 Array [
143143 "https://example.com",
144144 Object {
@@ -159,7 +159,7 @@ describe('runOpen util', () => {
159159 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
160160 `"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
161161 ) ;
162- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
162+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
163163 Array [
164164 "https://example.com/index.html",
165165 Object {
0 commit comments