Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed May 15, 2015
1 parent 2316135 commit 39f2869
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions client/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions docs/config/01-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
10 changes: 5 additions & 5 deletions lib/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var io = require('socket.io');
var Server = require('socket.io');
var di = require('di');

var cfg = require('./config');
Expand Down Expand Up @@ -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
});

Expand Down
6 changes: 3 additions & 3 deletions test/client/karma.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 39f2869

Please sign in to comment.