From 39f28694d756f4311908b7b219cf356850ef2c3d Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Fri, 15 May 2015 14:25:30 +0200 Subject: [PATCH] wip --- client/karma.js | 6 ++---- docs/config/01-configuration-file.md | 4 ++-- lib/config.js | 2 +- lib/server.js | 10 +++++----- test/client/karma.spec.js | 6 +++--- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/client/karma.js b/client/karma.js index 27f317759..d0074f0f6 100644 --- a/client/karma.js +++ b/client/karma.js @@ -218,12 +218,10 @@ var Karma = function(socket, iframe, opener, navigator, location) { // report browser name, id socket.on('connect', function() { - socket.io.engine.on('upgrade', function() { - currentTransport = socket.io.engine.transport.name; - }); + currentTransport = socket.socket.transport.name; // TODO(vojta): make resultsBufferLimit configurable - if (currentTransport === 'websocket' || currentTransport === 'flashsocket') { + if (currentTransport === 'websocket') { resultsBufferLimit = 1; } else { resultsBufferLimit = 50; diff --git a/docs/config/01-configuration-file.md b/docs/config/01-configuration-file.md index 645f57b21..d75c3b614 100644 --- a/docs/config/01-configuration-file.md +++ b/docs/config/01-configuration-file.md @@ -351,10 +351,10 @@ on whether all tests passed or any tests failed. ## transports **Type:** Array -**Default:** `['websocket', 'flashsocket', 'xhr-polling', 'jsonp-polling']` +**Default:** `['polling', 'websocket']` **Description:** An array of allowed transport methods between the browser and testing server. This configuration setting -is handed off to [socket.io](https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO) (which manages the communication +is handed off to [socket.io](http://socket.io/) (which manages the communication between browsers and the testing server). ## client.useIframe diff --git a/lib/config.js b/lib/config.js index c353c1938..81423fb64 100644 --- a/lib/config.js +++ b/lib/config.js @@ -223,7 +223,7 @@ var Config = function() { this.urlRoot = '/'; this.reportSlowerThan = 0; this.loggers = [constant.CONSOLE_APPENDER]; - this.transports = ['websocket', 'flashsocket', 'xhr-polling', 'jsonp-polling']; + this.transports = ['websocket', 'polling']; this.plugins = ['karma-*']; this.client = { args: [], diff --git a/lib/server.js b/lib/server.js index 6bdf30b5c..abdcda943 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1,4 +1,4 @@ -var io = require('socket.io'); +var Server = require('socket.io'); var di = require('di'); var cfg = require('./config'); @@ -258,16 +258,16 @@ start.$inject = ['injector', 'config', 'launcher', 'emitter', 'preprocess', 'fil var createSocketIoServer = function(webServer, executor, config) { - var server = io.listen(webServer, { + var server = new Server(webServer, { // avoid destroying http upgrades from socket.io to get proxied websockets working - 'destroy upgrade': false, + destroyUpgrade: false, // socket.io has a timeout (15s by default) before destroying a store (a data structure where // data associated with a socket are stored). Unfortunately this timeout is not cleared // properly on socket.io shutdown and this timeout prevents karma from exiting cleanly. // We change this timeout to 0 to make Karma exit just after all tests were executed. - 'client store expiration': 0, + //'client store expiration': 0, logger: logger.create('socket.io', constant.LOG_ERROR), - resource: config.urlRoot + 'socket.io', + path: config.urlRoot + 'socket.io/', transports: config.transports }); diff --git a/test/client/karma.spec.js b/test/client/karma.spec.js index e866e33c3..e6440771e 100644 --- a/test/client/karma.spec.js +++ b/test/client/karma.spec.js @@ -122,7 +122,7 @@ describe('Karma', function() { it('should buffer results when polling', function() { - setTransportTo('xhr-polling'); + setTransportTo('polling'); // emit 49 results for (var i = 1; i < 50; i++) { @@ -138,7 +138,7 @@ describe('Karma', function() { it('should buffer results when polling', function() { - setTransportTo('xhr-polling'); + setTransportTo('polling'); // emit 40 results for (var i = 1; i <= 40; i++) { @@ -237,7 +237,7 @@ describe('Karma', function() { var spyResult = jasmine.createSpy('onResult'); socket.on('result', spyResult); - setTransportTo('xhr-polling'); + setTransportTo('polling'); // emit 40 results for (var i = 0; i < 40; i++) {