@@ -156,3 +156,76 @@ describe('Client complex inline script path with sockPort', () => {
156
156
} ) ;
157
157
} ) ;
158
158
} ) ;
159
+
160
+ // previously, using sockPort without sockPath had the ability
161
+ // to alter the sockPath (based on a bug in client-src/index.js)
162
+ // so we need to make sure sockPath is not altered in this case
163
+ describe ( 'Client complex inline script path with sockPort, no sockPath' , ( ) => {
164
+ beforeAll ( ( done ) => {
165
+ const options = {
166
+ port : 9000 ,
167
+ host : '0.0.0.0' ,
168
+ inline : true ,
169
+ watchOptions : {
170
+ poll : true ,
171
+ } ,
172
+ sockPort : 8080 ,
173
+ } ;
174
+ helper . startAwaitingCompilation ( config , options , done ) ;
175
+ } ) ;
176
+
177
+ afterAll ( helper . close ) ;
178
+
179
+ describe ( 'browser client' , ( ) => {
180
+ jest . setTimeout ( 30000 ) ;
181
+
182
+ it ( 'uses the correct sockPort and sockPath' , ( done ) => {
183
+ runBrowser ( ) . then ( ( { page, browser } ) => {
184
+ page
185
+ . waitForRequest ( ( requestObj ) => requestObj . url ( ) . match ( / s o c k j s - n o d e / ) )
186
+ . then ( ( requestObj ) => {
187
+ expect ( requestObj . url ( ) ) . toMatch (
188
+ / ^ h t t p : \/ \/ l o c a l h o s t : 8 0 8 0 \/ s o c k j s - n o d e /
189
+ ) ;
190
+ browser . close ( ) . then ( done ) ;
191
+ } ) ;
192
+ page . goto ( 'http://localhost:9000/main' ) ;
193
+ } ) ;
194
+ } ) ;
195
+ } ) ;
196
+ } ) ;
197
+
198
+ describe ( 'Client complex inline script path with sockHost' , ( ) => {
199
+ beforeAll ( ( done ) => {
200
+ const options = {
201
+ port : 9000 ,
202
+ host : '0.0.0.0' ,
203
+ inline : true ,
204
+ watchOptions : {
205
+ poll : true ,
206
+ } ,
207
+ sockHost : 'myhost.test' ,
208
+ } ;
209
+ helper . startAwaitingCompilation ( config , options , done ) ;
210
+ } ) ;
211
+
212
+ afterAll ( helper . close ) ;
213
+
214
+ describe ( 'browser client' , ( ) => {
215
+ jest . setTimeout ( 30000 ) ;
216
+
217
+ it ( 'uses the correct sockHost' , ( done ) => {
218
+ runBrowser ( ) . then ( ( { page, browser } ) => {
219
+ page
220
+ . waitForRequest ( ( requestObj ) => requestObj . url ( ) . match ( / s o c k j s - n o d e / ) )
221
+ . then ( ( requestObj ) => {
222
+ expect ( requestObj . url ( ) ) . toMatch (
223
+ / ^ h t t p : \/ \/ m y h o s t \. t e s t : 9 0 0 0 \/ s o c k j s - n o d e /
224
+ ) ;
225
+ browser . close ( ) . then ( done ) ;
226
+ } ) ;
227
+ page . goto ( 'http://localhost:9000/main' ) ;
228
+ } ) ;
229
+ } ) ;
230
+ } ) ;
231
+ } ) ;
0 commit comments