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 {
@@ -122,7 +122,7 @@ describe('runOpen util', () => {
122122 const logMock = { warn : jest . fn ( ) } ;
123123
124124 beforeEach ( ( ) => {
125- opn . mockImplementation ( ( ) => Promise . reject ( ) ) ;
125+ open . mockImplementation ( ( ) => Promise . reject ( ) ) ;
126126 } ) ;
127127
128128 afterEach ( ( ) => {
@@ -134,7 +134,7 @@ describe('runOpen util', () => {
134134 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
135135 `"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
136136 ) ;
137- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
137+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
138138 Array [
139139 "https://example.com",
140140 Object {
@@ -154,7 +154,7 @@ describe('runOpen util', () => {
154154 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
155155 `"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
156156 ) ;
157- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
157+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
158158 Array [
159159 "https://example.com/index.html",
160160 Object {
@@ -174,7 +174,7 @@ describe('runOpen util', () => {
174174 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
175175 `"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
176176 ) ;
177- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
177+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
178178 Array [
179179 "https://example.com",
180180 Object {
@@ -195,7 +195,7 @@ describe('runOpen util', () => {
195195 expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
196196 `"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
197197 ) ;
198- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
198+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
199199 Array [
200200 "https://example.com/index.html",
201201 Object {
0 commit comments