1
1
'use strict' ;
2
2
3
- const opn = require ( 'opn ' ) ;
3
+ const open = require ( 'open ' ) ;
4
4
const runOpen = require ( '../../../lib/utils/runOpen' ) ;
5
5
6
- jest . mock ( 'opn ' ) ;
6
+ jest . mock ( 'open ' ) ;
7
7
8
8
describe ( 'runOpen util' , ( ) => {
9
9
afterEach ( ( ) => {
10
- opn . mockClear ( ) ;
10
+ open . mockClear ( ) ;
11
11
} ) ;
12
12
13
13
describe ( 'should open browser' , ( ) => {
14
14
beforeEach ( ( ) => {
15
- opn . mockImplementation ( ( ) => Promise . resolve ( ) ) ;
15
+ open . mockImplementation ( ( ) => Promise . resolve ( ) ) ;
16
16
} ) ;
17
17
18
18
it ( 'on specify URL' , ( ) => {
19
19
return runOpen ( 'https://example.com' , { } , console ) . then ( ( ) => {
20
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
20
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
21
21
Array [
22
22
"https://example.com",
23
23
Object {
@@ -34,7 +34,7 @@ describe('runOpen util', () => {
34
34
{ openPage : '/index.html' } ,
35
35
console
36
36
) . then ( ( ) => {
37
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
37
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
38
38
Array [
39
39
"https://example.com/index.html",
40
40
Object {
@@ -51,7 +51,7 @@ describe('runOpen util', () => {
51
51
{ open : 'Google Chrome' } ,
52
52
console
53
53
) . then ( ( ) => {
54
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
54
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
55
55
Array [
56
56
"https://example.com",
57
57
Object {
@@ -69,7 +69,7 @@ describe('runOpen util', () => {
69
69
{ open : 'Google Chrome' , openPage : '/index.html' } ,
70
70
console
71
71
) . then ( ( ) => {
72
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
72
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
73
73
Array [
74
74
"https://example.com/index.html",
75
75
Object {
@@ -122,7 +122,7 @@ describe('runOpen util', () => {
122
122
const logMock = { warn : jest . fn ( ) } ;
123
123
124
124
beforeEach ( ( ) => {
125
- opn . mockImplementation ( ( ) => Promise . reject ( ) ) ;
125
+ open . mockImplementation ( ( ) => Promise . reject ( ) ) ;
126
126
} ) ;
127
127
128
128
afterEach ( ( ) => {
@@ -134,7 +134,7 @@ describe('runOpen util', () => {
134
134
expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
135
135
`"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
136
136
) ;
137
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
137
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
138
138
Array [
139
139
"https://example.com",
140
140
Object {
@@ -154,7 +154,7 @@ describe('runOpen util', () => {
154
154
expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
155
155
`"Unable to open browser. If you are running in a headless environment, please do not use the --open flag"`
156
156
) ;
157
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
157
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
158
158
Array [
159
159
"https://example.com/index.html",
160
160
Object {
@@ -174,7 +174,7 @@ describe('runOpen util', () => {
174
174
expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
175
175
`"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
176
176
) ;
177
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
177
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
178
178
Array [
179
179
"https://example.com",
180
180
Object {
@@ -195,7 +195,7 @@ describe('runOpen util', () => {
195
195
expect ( logMock . warn . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot (
196
196
`"Unable to open browser: Google Chrome. If you are running in a headless environment, please do not use the --open flag"`
197
197
) ;
198
- expect ( opn . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
198
+ expect ( open . mock . calls [ 0 ] ) . toMatchInlineSnapshot ( `
199
199
Array [
200
200
"https://example.com/index.html",
201
201
Object {
0 commit comments