Skip to content

Commit c097ecf

Browse files
johnjbartonlusarz
authored andcommittedOct 5, 2018
fix(test/client): revert const/let changes.
We still test in IE9/10 where the var is king.
1 parent 637b553 commit c097ecf

File tree

5 files changed

+65
-64
lines changed

5 files changed

+65
-64
lines changed
 

Diff for: ‎test/client/karma.conf.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const TRAVIS_WITHOUT_BS = process.env.TRAVIS_SECURE_ENV_VARS === 'false'
1+
var TRAVIS_WITHOUT_BS = process.env.TRAVIS_SECURE_ENV_VARS === 'false'
22

3-
const launchers = {
3+
var launchers = {
44
bs_chrome: {
55
base: 'BrowserStack',
66
browser: 'chrome',
@@ -59,7 +59,7 @@ const launchers = {
5959
// }
6060
}
6161

62-
let browsers = []
62+
var browsers = []
6363

6464
if (process.env.TRAVIS) {
6565
if (TRAVIS_WITHOUT_BS) {

Diff for: ‎test/client/karma.spec.js

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// shim all the things
22
require('core-js/es5')
33
global.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

1111
describe('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

Diff for: ‎test/client/mocks.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function Emitter () {
2-
const listeners = {}
2+
var listeners = {}
33

44
this.on = function (event, fn) {
55
if (!listeners[event]) {
@@ -10,11 +10,11 @@ function Emitter () {
1010
}
1111

1212
this.emit = function (event) {
13-
const eventListeners = listeners[event]
13+
var eventListeners = listeners[event]
1414

1515
if (!eventListeners) return
1616

17-
let i = 0
17+
var i = 0
1818
while (i < eventListeners.length) {
1919
eventListeners[i].apply(null, Array.prototype.slice.call(arguments, 1))
2020
i++
@@ -27,7 +27,7 @@ function MockSocket () {
2727

2828
this.socket = {transport: {name: 'websocket'}}
2929

30-
let transportName = 'websocket'
30+
var transportName = 'websocket'
3131

3232
this.io = {
3333
engine: {

Diff for: ‎test/client/stringify.spec.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global __karma__ */
2-
const assert = require('assert')
2+
var assert = require('assert')
33

4-
const stringify = require('../../common/stringify')
4+
var stringify = require('../../common/stringify')
55

66
describe('stringify', function () {
77
if (window && window.Symbol) {
@@ -30,15 +30,15 @@ describe('stringify', function () {
3030
function abc (a, b, c) { return 'whatever' }
3131
function def (d, e, f) { return 'whatever' }
3232

33-
const abcString = stringify(abc)
34-
const partsAbc = ['function', 'abc', '(a, b, c)', '{ ... }']
35-
const partsDef = ['function', '(d, e, f)', '{ ... }']
33+
var abcString = stringify(abc)
34+
var partsAbc = ['function', 'abc', '(a, b, c)', '{ ... }']
35+
var partsDef = ['function', '(d, e, f)', '{ ... }']
3636

3737
partsAbc.forEach(function (part) {
3838
assert(abcString.indexOf(part) > -1)
3939
})
4040

41-
const defString = stringify(def)
41+
var defString = stringify(def)
4242
partsDef.forEach(function (part) {
4343
assert(defString.indexOf(part) > -1)
4444
})
@@ -48,7 +48,7 @@ describe('stringify', function () {
4848
// http://caniuse.com/#feat=proxy
4949
if (window.Proxy) {
5050
it('should serialize proxied functions', function () {
51-
const defProxy = new Proxy(function (d, e, f) { return 'whatever' }, {})
51+
var defProxy = new Proxy(function (d, e, f) { return 'whatever' }, {})
5252
assert.deepEqual(stringify(defProxy), 'function () { ... }')
5353
})
5454
}
@@ -58,7 +58,7 @@ describe('stringify', function () {
5858
})
5959

6060
it('should serialize objects', function () {
61-
let obj
61+
var obj
6262

6363
obj = {a: 'a', b: 'b', c: null, d: true, e: false}
6464
assert(stringify(obj).indexOf("{a: 'a', b: 'b', c: null, d: true, e: false}") > -1)
@@ -73,7 +73,7 @@ describe('stringify', function () {
7373
obj = {constructor: null}
7474

7575
// IE 7 serializes this to Object{}
76-
const s = stringify(obj)
76+
var s = stringify(obj)
7777
assert(s.indexOf('{constructor: null}') > -1 || s.indexOf('Object{}') > -1)
7878

7979
obj = Object.create(null)
@@ -83,7 +83,7 @@ describe('stringify', function () {
8383
})
8484

8585
it('should serialize html', function () {
86-
const div = document.createElement('div')
86+
var div = document.createElement('div')
8787

8888
assert.deepEqual(stringify(div).trim().toLowerCase(), '<div></div>')
8989

@@ -92,21 +92,21 @@ describe('stringify', function () {
9292
})
9393

9494
it('should serialize error', function () {
95-
const error = new TypeError('Error description')
95+
var error = new TypeError('Error description')
9696
assert(stringify(error).indexOf('Error description') > -1)
9797
})
9898

9999
it('should serialize DOMParser objects', function () {
100100
if (typeof DOMParser !== 'undefined') {
101101
// Test only works in IE 9 and above
102-
const parser = new DOMParser()
103-
const doc = parser.parseFromString('<test></test>', 'application/xml')
102+
var parser = new DOMParser()
103+
var doc = parser.parseFromString('<test></test>', 'application/xml')
104104
assert.deepEqual(stringify(doc), '<test></test>')
105105
}
106106
})
107107

108108
it('should serialize across iframes', function () {
109-
const div = document.createElement('div')
109+
var div = document.createElement('div')
110110
assert.deepEqual(__karma__.stringify(div).trim().toLowerCase(), '<div></div>')
111111

112112
assert.deepEqual(__karma__.stringify([1, 2]), '[1, 2]')

Diff for: ‎test/client/util.spec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
const assert = require('assert')
2-
const util = require('../../common/util')
1+
var assert = require('assert')
2+
3+
var util = require('../../common/util')
34

45
describe('util', function () {
56
it('parseQueryParams', function () {
6-
const params = util.parseQueryParams('?id=123&return_url=http://whatever.com')
7+
var params = util.parseQueryParams('?id=123&return_url=http://whatever.com')
78

89
assert.deepEqual(params, {id: '123', return_url: 'http://whatever.com'})
910
})

0 commit comments

Comments
 (0)
Please sign in to comment.