11// shim all the things
22require ( 'core-js/es5' )
33global . JSON = require ( 'json3' )
4- const sinon = require ( 'sinon' )
5- const assert = require ( 'assert' )
4+ var sinon = require ( 'sinon' )
5+ var assert = require ( 'assert' )
66
7- const ClientKarma = require ( '../../client/karma' )
8- const ContextKarma = require ( '../../context/karma' )
9- const MockSocket = require ( './mocks' ) . Socket
7+ var ClientKarma = require ( '../../client/karma' )
8+ var ContextKarma = require ( '../../context/karma' )
9+ var MockSocket = require ( './mocks' ) . Socket
1010
1111describe ( 'Karma' , function ( ) {
12- let socket , k , ck , windowNavigator , windowLocation , windowStub , startSpy , iframe , clientWindow
12+ var socket , k , ck , windowNavigator , windowLocation , windowStub , startSpy , iframe , clientWindow
1313
1414 function setTransportTo ( transportName ) {
1515 socket . _setTransportNameTo ( transportName )
@@ -33,7 +33,7 @@ describe('Karma', function () {
3333 } )
3434
3535 it ( 'should start execution when all files loaded and pass config' , function ( ) {
36- const config = ck . config = {
36+ var config = ck . config = {
3737 useIframe : true
3838 }
3939
@@ -45,7 +45,7 @@ describe('Karma', function () {
4545 } )
4646
4747 it ( 'should open a new window when useIFrame is false' , function ( ) {
48- const config = ck . config = {
48+ var config = ck . config = {
4949 useIframe : false ,
5050 runInParent : false
5151 }
@@ -85,13 +85,13 @@ describe('Karma', function () {
8585 } )
8686
8787 it ( 'should not set up context if there was an error' , function ( ) {
88- const config = ck . config = {
88+ var config = ck . config = {
8989 clearContext : true
9090 }
9191
9292 socket . emit ( 'execute' , config )
9393
94- const mockWindow = { }
94+ var mockWindow = { }
9595
9696 ck . error ( 'page reload' )
9797 ck . setupContext ( mockWindow )
@@ -101,13 +101,13 @@ describe('Karma', function () {
101101 } )
102102
103103 it ( 'should setup context if there was error but clearContext config is false' , function ( ) {
104- const config = ck . config = {
104+ var config = ck . config = {
105105 clearContext : false
106106 }
107107
108108 socket . emit ( 'execute' , config )
109109
110- const mockWindow = { }
110+ var mockWindow = { }
111111
112112 ck . error ( 'page reload' )
113113 ck . setupContext ( mockWindow )
@@ -118,11 +118,11 @@ describe('Karma', function () {
118118
119119 it ( 'should error out if a script attempted to reload the browser after setup' , function ( ) {
120120 // Perform setup
121- const config = ck . config = {
121+ var config = ck . config = {
122122 clearContext : true
123123 }
124124 socket . emit ( 'execute' , config )
125- const mockWindow = { }
125+ var mockWindow = { }
126126 ck . setupContext ( mockWindow )
127127
128128 // Spy on our error handler
@@ -136,7 +136,7 @@ describe('Karma', function () {
136136 } )
137137
138138 it ( 'should report navigator name' , function ( ) {
139- const spyInfo = sinon . spy ( function ( info ) {
139+ var spyInfo = sinon . spy ( function ( info ) {
140140 assert ( info . name === 'Fake browser name' )
141141 } )
142142
@@ -153,7 +153,7 @@ describe('Karma', function () {
153153 socket = new MockSocket ( )
154154 k = new ClientKarma ( socket , { } , windowStub , windowNavigator , windowLocation )
155155
156- const spyInfo = sinon . spy ( function ( info ) {
156+ var spyInfo = sinon . spy ( function ( info ) {
157157 assert ( info . id === '567' )
158158 } )
159159
@@ -165,13 +165,13 @@ describe('Karma', function () {
165165
166166 describe ( 'result' , function ( ) {
167167 it ( 'should buffer results when polling' , function ( ) {
168- const spyResult = sinon . stub ( )
168+ var spyResult = sinon . stub ( )
169169 socket . on ( 'result' , spyResult )
170170
171171 setTransportTo ( 'polling' )
172172
173173 // emit 49 results
174- for ( let i = 1 ; i < 50 ; i ++ ) {
174+ for ( var i = 1 ; i < 50 ; i ++ ) {
175175 ck . result ( { id : i } )
176176 }
177177
@@ -183,13 +183,13 @@ describe('Karma', function () {
183183 } )
184184
185185 it ( 'should buffer results when polling' , function ( ) {
186- const spyResult = sinon . stub ( )
186+ var spyResult = sinon . stub ( )
187187 socket . on ( 'result' , spyResult )
188188
189189 setTransportTo ( 'polling' )
190190
191191 // emit 40 results
192- for ( let i = 1 ; i <= 40 ; i ++ ) {
192+ for ( var i = 1 ; i <= 40 ; i ++ ) {
193193 ck . result ( { id : i } )
194194 }
195195
@@ -199,7 +199,7 @@ describe('Karma', function () {
199199 } )
200200
201201 it ( 'should emit "start" with total specs count first' , function ( ) {
202- const log = [ ]
202+ var log = [ ]
203203
204204 socket . on ( 'result' , function ( ) {
205205 log . push ( 'result' )
@@ -217,13 +217,13 @@ describe('Karma', function () {
217217 } )
218218
219219 it ( 'should not emit "start" if already done by the adapter' , function ( ) {
220- const log = [ ]
220+ var log = [ ]
221221
222- const spyStart = sinon . spy ( function ( ) {
222+ var spyStart = sinon . spy ( function ( ) {
223223 log . push ( 'start' )
224224 } )
225225
226- const spyResult = sinon . spy ( function ( ) {
226+ var spyResult = sinon . spy ( function ( ) {
227227 log . push ( 'result' )
228228 } )
229229
@@ -243,7 +243,7 @@ describe('Karma', function () {
243243 it ( 'should capture alert' , function ( ) {
244244 sinon . spy ( ck , 'log' )
245245
246- const mockWindow = {
246+ var mockWindow = {
247247 alert : function ( ) {
248248 throw new Error ( 'Alert was not patched!' )
249249 }
@@ -256,43 +256,43 @@ describe('Karma', function () {
256256
257257 it ( 'should capture confirm' , function ( ) {
258258 sinon . spy ( ck , 'log' )
259- let confirmCalled = false
259+ var confirmCalled = false
260260
261- const mockWindow = {
261+ var mockWindow = {
262262 confirm : function ( ) {
263263 confirmCalled = true
264264 return true
265265 }
266266 }
267267
268268 ck . setupContext ( mockWindow )
269- const confirmResult = mockWindow . confirm ( 'What?' )
269+ var confirmResult = mockWindow . confirm ( 'What?' )
270270 assert ( ck . log . calledWith ( 'confirm' , [ 'What?' ] ) )
271271 assert . equal ( confirmCalled , true )
272272 assert . equal ( confirmResult , true )
273273 } )
274274
275275 it ( 'should capture prompt' , function ( ) {
276276 sinon . spy ( ck , 'log' )
277- let promptCalled = false
277+ var promptCalled = false
278278
279- const mockWindow = {
279+ var mockWindow = {
280280 prompt : function ( ) {
281281 promptCalled = true
282282 return 'user-input'
283283 }
284284 }
285285
286286 ck . setupContext ( mockWindow )
287- const promptResult = mockWindow . prompt ( 'What is your favorite color?' , 'blue' )
287+ var promptResult = mockWindow . prompt ( 'What is your favorite color?' , 'blue' )
288288 assert ( ck . log . calledWith ( 'prompt' , [ 'What is your favorite color?' , 'blue' ] ) )
289289 assert . equal ( promptCalled , true )
290290 assert . equal ( promptResult , 'user-input' )
291291 } )
292292 } )
293293
294294 describe ( 'complete' , function ( ) {
295- let clock
295+ var clock
296296
297297 before ( function ( ) {
298298 clock = sinon . useFakeTimers ( )
@@ -303,13 +303,13 @@ describe('Karma', function () {
303303 } )
304304
305305 it ( 'should clean the result buffer before completing' , function ( ) {
306- const spyResult = sinon . stub ( )
306+ var spyResult = sinon . stub ( )
307307 socket . on ( 'result' , spyResult )
308308
309309 setTransportTo ( 'polling' )
310310
311311 // emit 40 results
312- for ( let i = 0 ; i < 40 ; i ++ ) {
312+ for ( var i = 0 ; i < 40 ; i ++ ) {
313313 ck . result ( { id : i } )
314314 }
315315
@@ -347,7 +347,7 @@ describe('Karma', function () {
347347 sinon . spy ( ck , 'log' )
348348 ck . config . captureConsole = true
349349
350- const mockWindow = {
350+ var mockWindow = {
351351 console : {
352352 log : function ( ) { }
353353 }
@@ -363,7 +363,7 @@ describe('Karma', function () {
363363 sinon . spy ( ck , 'log' )
364364 ck . config . captureConsole = false
365365
366- const mockWindow = {
366+ var mockWindow = {
367367 console : {
368368 log : function ( ) { }
369369 }
@@ -375,12 +375,12 @@ describe('Karma', function () {
375375 } )
376376
377377 it ( 'should clear context window upon complete when clearContext config is true' , function ( ) {
378- const config = ck . config = {
378+ var config = ck . config = {
379379 clearContext : true
380380 }
381381
382382 socket . emit ( 'execute' , config )
383- const CURRENT_URL = iframe . src
383+ var CURRENT_URL = iframe . src
384384
385385 ck . complete ( )
386386
@@ -392,12 +392,12 @@ describe('Karma', function () {
392392 } )
393393
394394 it ( 'should not clear context window upon complete when clearContext config is false' , function ( ) {
395- const config = ck . config = {
395+ var config = ck . config = {
396396 clearContext : false
397397 }
398398
399399 socket . emit ( 'execute' , config )
400- const CURRENT_URL = iframe . src
400+ var CURRENT_URL = iframe . src
401401
402402 ck . complete ( )
403403
0 commit comments