2
2
3
3
var sinon = require ( 'sinon' ) ;
4
4
5
- describe ( 'client' , function ( ) {
5
+ describe ( 'client' , function ( ) {
6
6
var s , client , clientOverlay , processUpdate ;
7
7
8
- beforeEach ( function ( ) {
8
+ beforeEach ( function ( ) {
9
9
s = sinon . createSandbox ( { useFakeTimers : true } ) ;
10
10
} ) ;
11
- afterEach ( function ( ) {
11
+ afterEach ( function ( ) {
12
12
s . restore ( ) ;
13
13
} ) ;
14
14
15
- context ( 'with default options' , function ( ) {
15
+ context ( 'with default options' , function ( ) {
16
16
beforeEach ( function setup ( ) {
17
17
global . __resourceQuery = '' ; // eslint-disable-line no-underscore-dangle
18
18
global . document = { } ;
@@ -23,12 +23,12 @@ describe('client', function() {
23
23
} ;
24
24
} ) ;
25
25
beforeEach ( loadClient ) ;
26
- it ( 'should connect to __webpack_hmr' , function ( ) {
26
+ it ( 'should connect to __webpack_hmr' , function ( ) {
27
27
sinon . assert . calledOnce ( window . EventSource ) ;
28
28
sinon . assert . calledWithNew ( window . EventSource ) ;
29
29
sinon . assert . calledWith ( window . EventSource , '/__webpack_hmr' ) ;
30
30
} ) ;
31
- it ( 'should trigger webpack on successful builds' , function ( ) {
31
+ it ( 'should trigger webpack on successful builds' , function ( ) {
32
32
var eventSource = window . EventSource . lastCall . returnValue ;
33
33
eventSource . onmessage (
34
34
makeMessage ( {
@@ -42,7 +42,7 @@ describe('client', function() {
42
42
) ;
43
43
sinon . assert . calledOnce ( processUpdate ) ;
44
44
} ) ;
45
- it ( 'should trigger webpack on successful syncs' , function ( ) {
45
+ it ( 'should trigger webpack on successful syncs' , function ( ) {
46
46
var eventSource = window . EventSource . lastCall . returnValue ;
47
47
eventSource . onmessage (
48
48
makeMessage ( {
@@ -56,7 +56,7 @@ describe('client', function() {
56
56
) ;
57
57
sinon . assert . calledOnce ( processUpdate ) ;
58
58
} ) ;
59
- it ( 'should call subscribeAll handler on default messages' , function ( ) {
59
+ it ( 'should call subscribeAll handler on default messages' , function ( ) {
60
60
var spy = sinon . spy ( ) ;
61
61
client . subscribeAll ( spy ) ;
62
62
var message = {
@@ -74,7 +74,7 @@ describe('client', function() {
74
74
sinon . assert . calledOnce ( spy ) ;
75
75
sinon . assert . calledWith ( spy , message ) ;
76
76
} ) ;
77
- it ( 'should call subscribeAll handler on custom messages' , function ( ) {
77
+ it ( 'should call subscribeAll handler on custom messages' , function ( ) {
78
78
var spy = sinon . spy ( ) ;
79
79
client . subscribeAll ( spy ) ;
80
80
@@ -88,7 +88,7 @@ describe('client', function() {
88
88
sinon . assert . calledOnce ( spy ) ;
89
89
sinon . assert . calledWith ( spy , { action : 'thingy' } ) ;
90
90
} ) ;
91
- it ( 'should call only custom handler on custom messages' , function ( ) {
91
+ it ( 'should call only custom handler on custom messages' , function ( ) {
92
92
var spy = sinon . spy ( ) ;
93
93
client . subscribe ( spy ) ;
94
94
@@ -108,7 +108,7 @@ describe('client', function() {
108
108
sinon . assert . calledWith ( spy , { custom : 'thingy' } ) ;
109
109
sinon . assert . notCalled ( processUpdate ) ;
110
110
} ) ;
111
- it ( 'should not trigger webpack on errored builds' , function ( ) {
111
+ it ( 'should not trigger webpack on errored builds' , function ( ) {
112
112
var eventSource = window . EventSource . lastCall . returnValue ;
113
113
eventSource . onmessage (
114
114
makeMessage ( {
@@ -122,7 +122,7 @@ describe('client', function() {
122
122
) ;
123
123
sinon . assert . notCalled ( processUpdate ) ;
124
124
} ) ;
125
- it ( 'should show overlay on errored builds' , function ( ) {
125
+ it ( 'should show overlay on errored builds' , function ( ) {
126
126
var eventSource = window . EventSource . lastCall . returnValue ;
127
127
eventSource . onmessage (
128
128
makeMessage ( {
@@ -140,7 +140,7 @@ describe('client', function() {
140
140
'Actually, 2 things broke' ,
141
141
] ) ;
142
142
} ) ;
143
- it ( 'should hide overlay after errored build fixed' , function ( ) {
143
+ it ( 'should hide overlay after errored build fixed' , function ( ) {
144
144
var eventSource = window . EventSource . lastCall . returnValue ;
145
145
eventSource . onmessage (
146
146
makeMessage ( {
@@ -165,7 +165,7 @@ describe('client', function() {
165
165
sinon . assert . calledOnce ( clientOverlay . showProblems ) ;
166
166
sinon . assert . calledOnce ( clientOverlay . clear ) ;
167
167
} ) ;
168
- it ( 'should hide overlay after errored build becomes warning' , function ( ) {
168
+ it ( 'should hide overlay after errored build becomes warning' , function ( ) {
169
169
var eventSource = window . EventSource . lastCall . returnValue ;
170
170
eventSource . onmessage (
171
171
makeMessage ( {
@@ -190,7 +190,7 @@ describe('client', function() {
190
190
sinon . assert . calledOnce ( clientOverlay . showProblems ) ;
191
191
sinon . assert . calledOnce ( clientOverlay . clear ) ;
192
192
} ) ;
193
- it ( 'should trigger webpack on warning builds' , function ( ) {
193
+ it ( 'should trigger webpack on warning builds' , function ( ) {
194
194
var eventSource = window . EventSource . lastCall . returnValue ;
195
195
eventSource . onmessage (
196
196
makeMessage ( {
@@ -204,7 +204,7 @@ describe('client', function() {
204
204
) ;
205
205
sinon . assert . calledOnce ( processUpdate ) ;
206
206
} ) ;
207
- it ( 'should not overlay on warning builds' , function ( ) {
207
+ it ( 'should not overlay on warning builds' , function ( ) {
208
208
var eventSource = window . EventSource . lastCall . returnValue ;
209
209
eventSource . onmessage (
210
210
makeMessage ( {
@@ -218,7 +218,7 @@ describe('client', function() {
218
218
) ;
219
219
sinon . assert . notCalled ( clientOverlay . showProblems ) ;
220
220
} ) ;
221
- it ( 'should show overlay after warning build becomes error' , function ( ) {
221
+ it ( 'should show overlay after warning build becomes error' , function ( ) {
222
222
var eventSource = window . EventSource . lastCall . returnValue ;
223
223
eventSource . onmessage (
224
224
makeMessage ( {
@@ -245,7 +245,7 @@ describe('client', function() {
245
245
it ( "should test more of the client's functionality" ) ;
246
246
} ) ;
247
247
248
- context ( 'with overlayWarnings: true' , function ( ) {
248
+ context ( 'with overlayWarnings: true' , function ( ) {
249
249
beforeEach ( function setup ( ) {
250
250
global . __resourceQuery = '?overlayWarnings=true' ; // eslint-disable-line no-underscore-dangle
251
251
global . document = { } ;
@@ -256,7 +256,7 @@ describe('client', function() {
256
256
} ;
257
257
} ) ;
258
258
beforeEach ( loadClient ) ;
259
- it ( 'should show overlay on errored builds' , function ( ) {
259
+ it ( 'should show overlay on errored builds' , function ( ) {
260
260
var eventSource = window . EventSource . lastCall . returnValue ;
261
261
eventSource . onmessage (
262
262
makeMessage ( {
@@ -274,7 +274,7 @@ describe('client', function() {
274
274
'Actually, 2 things broke' ,
275
275
] ) ;
276
276
} ) ;
277
- it ( 'should hide overlay after errored build fixed' , function ( ) {
277
+ it ( 'should hide overlay after errored build fixed' , function ( ) {
278
278
var eventSource = window . EventSource . lastCall . returnValue ;
279
279
eventSource . onmessage (
280
280
makeMessage ( {
@@ -299,7 +299,7 @@ describe('client', function() {
299
299
sinon . assert . calledOnce ( clientOverlay . showProblems ) ;
300
300
sinon . assert . calledOnce ( clientOverlay . clear ) ;
301
301
} ) ;
302
- it ( 'should show overlay on warning builds' , function ( ) {
302
+ it ( 'should show overlay on warning builds' , function ( ) {
303
303
var eventSource = window . EventSource . lastCall . returnValue ;
304
304
eventSource . onmessage (
305
305
makeMessage ( {
@@ -316,7 +316,7 @@ describe('client', function() {
316
316
"This isn't great, but it's not terrible" ,
317
317
] ) ;
318
318
} ) ;
319
- it ( 'should hide overlay after warning build fixed' , function ( ) {
319
+ it ( 'should hide overlay after warning build fixed' , function ( ) {
320
320
var eventSource = window . EventSource . lastCall . returnValue ;
321
321
eventSource . onmessage (
322
322
makeMessage ( {
@@ -341,7 +341,7 @@ describe('client', function() {
341
341
sinon . assert . calledOnce ( clientOverlay . showProblems ) ;
342
342
sinon . assert . calledOnce ( clientOverlay . clear ) ;
343
343
} ) ;
344
- it ( 'should update overlay after errored build becomes warning' , function ( ) {
344
+ it ( 'should update overlay after errored build becomes warning' , function ( ) {
345
345
var eventSource = window . EventSource . lastCall . returnValue ;
346
346
eventSource . onmessage (
347
347
makeMessage ( {
@@ -369,7 +369,7 @@ describe('client', function() {
369
369
} ) ;
370
370
} ) ;
371
371
372
- context ( 'with name options' , function ( ) {
372
+ context ( 'with name options' , function ( ) {
373
373
beforeEach ( function setup ( ) {
374
374
global . __resourceQuery = '?name=test' ; // eslint-disable-line no-underscore-dangle
375
375
global . window = {
@@ -379,7 +379,7 @@ describe('client', function() {
379
379
} ;
380
380
} ) ;
381
381
beforeEach ( loadClient ) ;
382
- it ( 'should not trigger webpack if event obj name is different' , function ( ) {
382
+ it ( 'should not trigger webpack if event obj name is different' , function ( ) {
383
383
var eventSource = window . EventSource . lastCall . returnValue ;
384
384
eventSource . onmessage (
385
385
makeMessage ( {
@@ -394,7 +394,7 @@ describe('client', function() {
394
394
) ;
395
395
sinon . assert . notCalled ( processUpdate ) ;
396
396
} ) ;
397
- it ( 'should not trigger webpack on successful syncs if obj name is different' , function ( ) {
397
+ it ( 'should not trigger webpack on successful syncs if obj name is different' , function ( ) {
398
398
var eventSource = window . EventSource . lastCall . returnValue ;
399
399
eventSource . onmessage (
400
400
makeMessage ( {
@@ -411,25 +411,25 @@ describe('client', function() {
411
411
} ) ;
412
412
} ) ;
413
413
414
- context ( 'with no browser environment' , function ( ) {
414
+ context ( 'with no browser environment' , function ( ) {
415
415
beforeEach ( function setup ( ) {
416
416
global . __resourceQuery = '' ; // eslint-disable-line no-underscore-dangle
417
417
delete global . window ;
418
418
} ) ;
419
419
beforeEach ( loadClient ) ;
420
- it ( 'should not connect' , function ( ) {
420
+ it ( 'should not connect' , function ( ) {
421
421
// doesn't error
422
422
} ) ;
423
423
} ) ;
424
424
425
- context ( 'with no EventSource' , function ( ) {
425
+ context ( 'with no EventSource' , function ( ) {
426
426
beforeEach ( function setup ( ) {
427
427
global . __resourceQuery = '' ; // eslint-disable-line no-underscore-dangle
428
428
global . window = { } ;
429
429
s . stub ( console , 'warn' ) ;
430
430
} ) ;
431
431
beforeEach ( loadClient ) ;
432
- it ( 'should emit warning and not connect' , function ( ) {
432
+ it ( 'should emit warning and not connect' , function ( ) {
433
433
sinon . assert . calledOnce ( console . warn ) ;
434
434
sinon . assert . calledWithMatch ( console . warn , / E v e n t S o u r c e / ) ;
435
435
} ) ;
@@ -445,10 +445,10 @@ describe('client', function() {
445
445
client = require ( path ) ;
446
446
}
447
447
448
- beforeEach ( function ( ) {
448
+ beforeEach ( function ( ) {
449
449
clientOverlay = { showProblems : sinon . stub ( ) , clear : sinon . stub ( ) } ;
450
450
var clientOverlayModule = {
451
- exports : function ( ) {
451
+ exports : function ( ) {
452
452
return clientOverlay ;
453
453
} ,
454
454
} ;
@@ -459,7 +459,7 @@ describe('client', function() {
459
459
exports : processUpdate ,
460
460
} ;
461
461
} ) ;
462
- afterEach ( function ( ) {
462
+ afterEach ( function ( ) {
463
463
delete require . cache [ require . resolve ( '../client-overlay' ) ] ;
464
464
delete require . cache [ require . resolve ( '../process-update' ) ] ;
465
465
} ) ;
0 commit comments