@@ -31,7 +31,7 @@ function getAddress(host, hostname) {
31
31
return { address } ;
32
32
}
33
33
34
- describe ( "host" , { tag : "@flaky" } , ( ) => {
34
+ describe ( "host" , { tag : [ "@flaky" , "@fails" ] } , ( ) => {
35
35
const hosts = [
36
36
"<not-specified>" ,
37
37
// eslint-disable-next-line no-undefined
@@ -47,77 +47,81 @@ describe("host", { tag: "@flaky" }, () => {
47
47
] ;
48
48
49
49
for ( let host of hosts ) {
50
- test ( `should work using "${ host } " host and port as number` , { tag : "@fails" } , async ( {
51
- page,
52
- } ) => {
53
- const compiler = webpack ( config ) ;
54
-
55
- if ( ! ipv6 || isMacOS ) {
56
- if ( host === "::" ) {
57
- host = "127.0.0.1" ;
58
- } else if ( host === "::1" ) {
59
- host = "127.0.0.1" ;
60
- } else if ( host === "local-ipv6" ) {
61
- host = "127.0.0.1" ;
50
+ test (
51
+ `should work using "${ host } " host and port as number` ,
52
+ { tag : "@fails" } ,
53
+ async ( { page } ) => {
54
+ const compiler = webpack ( config ) ;
55
+
56
+ if ( ! ipv6 || isMacOS ) {
57
+ if ( host === "::" ) {
58
+ host = "127.0.0.1" ;
59
+ } else if ( host === "::1" ) {
60
+ host = "127.0.0.1" ;
61
+ } else if ( host === "local-ipv6" ) {
62
+ host = "127.0.0.1" ;
63
+ }
62
64
}
63
- }
64
65
65
- const devServerOptions = { port } ;
66
+ const devServerOptions = { port } ;
66
67
67
- if ( host !== "<not-specified>" ) {
68
- devServerOptions . host = host ;
69
- }
70
-
71
- const server = new Server ( devServerOptions , compiler ) ;
68
+ if ( host !== "<not-specified>" ) {
69
+ devServerOptions . host = host ;
70
+ }
72
71
73
- let hostname = host ;
72
+ const server = new Server ( devServerOptions , compiler ) ;
73
+
74
+ let hostname = host ;
75
+
76
+ if ( hostname === "0.0.0.0" ) {
77
+ hostname = "127.0.0.1" ;
78
+ } else if (
79
+ hostname === "<not-specified>" ||
80
+ typeof hostname === "undefined" ||
81
+ hostname === "::" ||
82
+ hostname === "::1"
83
+ ) {
84
+ hostname = "[::1]" ;
85
+ } else if ( hostname === "local-ip" || hostname === "local-ipv4" ) {
86
+ hostname = ipv4 ;
87
+ } else if ( hostname === "local-ipv6" ) {
88
+ hostname = `[${ ipv6 } ]` ;
89
+ }
74
90
75
- if ( hostname === "0.0.0.0" ) {
76
- hostname = "127.0.0.1" ;
77
- } else if (
78
- hostname === "<not-specified>" ||
79
- typeof hostname === "undefined" ||
80
- hostname === "::" ||
81
- hostname === "::1"
82
- ) {
83
- hostname = "[::1]" ;
84
- } else if ( hostname === "local-ip" || hostname === "local-ipv4" ) {
85
- hostname = ipv4 ;
86
- } else if ( hostname === "local-ipv6" ) {
87
- hostname = `[${ ipv6 } ]` ;
88
- }
91
+ await server . start ( ) ;
89
92
90
- await server . start ( ) ;
93
+ expect ( server . server . address ( ) ) . toMatchObject (
94
+ getAddress ( host , hostname ) ,
95
+ ) ;
91
96
92
- expect ( server . server . address ( ) ) . toMatchObject ( getAddress ( host , hostname ) ) ;
97
+ try {
98
+ const pageErrors = [ ] ;
99
+ const consoleMessages = [ ] ;
93
100
94
- try {
95
- const pageErrors = [ ] ;
96
- const consoleMessages = [ ] ;
101
+ page
102
+ . on ( "console" , ( message ) => {
103
+ consoleMessages . push ( message ) ;
104
+ } )
105
+ . on ( "pageerror" , ( error ) => {
106
+ pageErrors . push ( error ) ;
107
+ } ) ;
97
108
98
- page
99
- . on ( "console" , ( message ) => {
100
- consoleMessages . push ( message ) ;
101
- } )
102
- . on ( "pageerror" , ( error ) => {
103
- pageErrors . push ( error ) ;
109
+ await page . goto ( `http://${ hostname } :${ port } /` , {
110
+ waitUntil : "networkidle0" ,
104
111
} ) ;
105
112
106
- await page . goto ( `http:// ${ hostname } : ${ port } /` , {
107
- waitUntil : "networkidle0" ,
108
- } ) ;
113
+ expect (
114
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
115
+ ) . toMatchSnapshotWithArray ( ) ;
109
116
110
- expect (
111
- consoleMessages . map ( ( message ) => message . text ( ) ) )
112
- . toMatchSnapshotWithArray ( ) ;
113
-
114
- expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
115
- } catch ( error ) {
116
- throw error ;
117
- } finally {
118
- await server . stop ( ) ;
119
- }
120
- } ) ;
117
+ expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
118
+ } catch ( error ) {
119
+ throw error ;
120
+ } finally {
121
+ await server . stop ( ) ;
122
+ }
123
+ } ,
124
+ ) ;
121
125
122
126
test ( `should work using "${ host } " host and port as string` , async ( {
123
127
page,
@@ -180,8 +184,8 @@ describe("host", { tag: "@flaky" }, () => {
180
184
} ) ;
181
185
182
186
expect (
183
- consoleMessages . map ( ( message ) => message . text ( ) ) )
184
- . toMatchSnapshotWithArray ( ) ;
187
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
188
+ ) . toMatchSnapshotWithArray ( ) ;
185
189
186
190
expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
187
191
} catch ( error ) {
@@ -256,8 +260,8 @@ describe("host", { tag: "@flaky" }, () => {
256
260
} ) ;
257
261
258
262
expect (
259
- consoleMessages . map ( ( message ) => message . text ( ) ) )
260
- . toMatchSnapshotWithArray ( ) ;
263
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
264
+ ) . toMatchSnapshotWithArray ( ) ;
261
265
262
266
expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
263
267
} catch ( error ) {
0 commit comments