Skip to content

Commit 8cde767

Browse files
[test] Update travis configuration (#594)
1 parent 0071fdf commit 8cde767

File tree

6 files changed

+42
-53
lines changed

6 files changed

+42
-53
lines changed

.travis.yml

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,20 @@ node_js:
44
- '4'
55
- '6'
66
- '8'
7+
- node
78
git:
89
depth: 1
910
notifications:
10-
irc: "irc.freenode.org#socket.io"
11+
irc: irc.freenode.org#socket.io
1112
matrix:
1213
include:
13-
- node_js: 'node'
14-
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
15-
- node_js: 'node'
16-
env: BROWSER_NAME=safari BROWSER_VERSION=latest
17-
- node_js: 'node'
18-
env: BROWSER_NAME=firefox BROWSER_VERSION=latest
19-
- node_js: 'node'
20-
env: BROWSER_NAME=ie BROWSER_VERSION=8
21-
- node_js: 'node'
22-
env: BROWSER_NAME=ie BROWSER_VERSION=9
23-
- node_js: 'node'
24-
env: BROWSER_NAME=ie BROWSER_VERSION=10
25-
- node_js: 'node'
26-
env: BROWSER_NAME=ie BROWSER_VERSION=11
27-
- node_js: 'node'
28-
env: BROWSER_NAME=iphone BROWSER_VERSION=8.4
29-
- node_js: 'node'
30-
env: BROWSER_NAME=iphone BROWSER_VERSION=9.2
31-
- node_js: 'node'
32-
env: BROWSER_NAME=iphone BROWSER_VERSION=10.0
33-
- node_js: 'node'
34-
env: BROWSER_NAME=android BROWSER_VERSION=4.4
35-
- node_js: 'node'
36-
env: BROWSER_NAME=android BROWSER_VERSION=5.1
37-
- node_js: 'node'
38-
env: BROWSER_NAME=ipad BROWSER_VERSION=9.3
39-
- node_js: 'node'
40-
env: BROWSER_NAME=ipad BROWSER_VERSION=10.0
14+
- node_js: node
15+
env: BROWSERS=1
16+
cache:
17+
directories:
18+
- node_modules
19+
env:
20+
global:
21+
- secure: EeWHa83dNLzbmwn7tai2D7nnqRMhpbZrWh8054je+6M2Iui6heV412ginyx+MfTBkDe9PF9yPhoknpJ1ZiitbFHVhdofzJJErEHWS33gLVXTL2PU1IzAU9h9T/wVSrVsiNfTARW4Bh9JexVl8x8erTzSh/P6fH2KWx4CaPtmYG4=
22+
- secure: 0yzzTFfFW032oyHzLJPkjgtehnJiqbpmI5kPosjC3Nk0AT6wLSdXuo1Cv5mccggPoqtHQ4oo7e4roLgRaZD34ihc2n98oT5LUPoU6ifA2Z+1zmdmFS9oYTvmkMxaxHlyYuWn47INukGLVJkH5mukb4QDji+v2LjbZVGdVHL5iNM=
23+
- secure: l2aD07VwTMZh+8dcE7u7X0lpdYuwl/wk5no1hxaOKvnHiaVSW39kEJFReO0EZXF/ld7teBNwdWVtRK0P28hKjXEr4Z1OjvGyz6WYZ6cSwxAPmDoTaKC4z1NsAlatqjOKyjSqadncYzWwKS+Trxgj8eO1mZt5h+EvgU2gz6l2N+I=

gulpfile.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const FILES_TO_CLEAN = [
3838
];
3939

4040
gulp.task('test', ['lint'], function () {
41-
if (process.env.hasOwnProperty('BROWSER_NAME')) {
41+
if (process.env.hasOwnProperty('BROWSERS')) {
4242
return testZuul();
4343
} else {
4444
return testNode();
@@ -78,18 +78,7 @@ function testNode () {
7878
// runs zuul through shell process
7979
function testZuul () {
8080
const ZUUL_CMD = './node_modules/zuul/bin/zuul';
81-
const args = [
82-
'--browser-name',
83-
process.env.BROWSER_NAME,
84-
'--browser-version',
85-
process.env.BROWSER_VERSION
86-
];
87-
if (process.env.hasOwnProperty('BROWSER_PLATFORM')) {
88-
args.push('--browser-platform');
89-
args.push(process.env.BROWSER_PLATFORM);
90-
}
91-
args.push(TEST_FILE);
92-
const zuulChild = child.spawn(ZUUL_CMD, args, { stdio: 'inherit' });
81+
const zuulChild = child.spawn(ZUUL_CMD, [TEST_FILE], { stdio: 'inherit' });
9382
zuulChild.on('exit', function (code) {
9483
cleanFiles(FILES_TO_CLEAN);
9584
process.exit(code);

lib/transports/polling-xhr.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,9 @@ Request.prototype.onLoad = function () {
358358
contentType = this.xhr.getResponseHeader('Content-Type');
359359
} catch (e) {}
360360
if (contentType === 'application/octet-stream') {
361-
if (this.xhr.responseType === 'arraybuffer') {
362-
data = this.xhr.response || this.xhr.responseText;
363-
} else {
364-
data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
365-
}
361+
data = this.xhr.response || this.xhr.responseText;
362+
} else if (this.xhr.responseType === 'arraybuffer') {
363+
data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
366364
} else {
367365
data = this.xhr.responseText;
368366
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"gulp-task-listing": "1.0.1",
5959
"istanbul": "^0.4.5",
6060
"mocha": "^3.2.0",
61+
"socket.io-browsers": "^1.0.0",
6162
"webpack": "1.12.12",
6263
"webpack-stream": "^3.2.0",
6364
"zuul": "^3.11.1",

test/engine.io-client.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
var expect = require('expect.js');
33
var eio = require('../');
44

5+
var expectedPort = global.location && 'https:' === location.protocol ? '443' : '80';
6+
57
describe('engine.io-client', function () {
68
var open;
79

@@ -45,7 +47,7 @@ describe('engine.io-client', function () {
4547
it('should properly parse a host without port', function () {
4648
var client = eio({ host: 'localhost' });
4749
expect(client.hostname).to.be('localhost');
48-
expect(client.port).to.be('80');
50+
expect(client.port).to.be(expectedPort);
4951
});
5052

5153
it('should properly parse a host with port', function () {
@@ -69,7 +71,7 @@ describe('engine.io-client', function () {
6971
it('should properly parse an IPv6 host without port (1/2)', function () {
7072
var client = eio({ host: '[::1]' });
7173
expect(client.hostname).to.be('::1');
72-
expect(client.port).to.be('80');
74+
expect(client.port).to.be(expectedPort);
7375
});
7476

7577
it('should properly parse an IPv6 host without port (2/2)', function () {
@@ -87,6 +89,6 @@ describe('engine.io-client', function () {
8789
it('should properly parse an IPv6 host without brace', function () {
8890
var client = eio({ host: '::1' });
8991
expect(client.hostname).to.be('::1');
90-
expect(client.port).to.be('80');
92+
expect(client.port).to.be(expectedPort);
9193
});
9294
});

zuul.config.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1+
'use strict';
2+
3+
var browsers = require('socket.io-browsers');
14

25
var zuulConfig = module.exports = {
36
ui: 'mocha-bdd',
7+
8+
// test on localhost by default
9+
local: true,
10+
11+
concurrency: 2, // ngrok only accepts two tunnels by default
12+
// if browser does not sends output in 120s since last output:
13+
// stop testing, something is wrong
14+
browser_output_timeout: 120 * 1000,
15+
browser_open_timeout: 60 * 4 * 1000,
16+
// we want to be notified something is wrong asap, so no retry
17+
browser_retries: 1,
18+
419
server: './test/support/server.js',
5-
local: true, // test on localhost by default
620
builder: 'zuul-builder-webpack',
721
webpack: require('./support/webpack.config.js')
822
};
@@ -11,7 +25,9 @@ if (process.env.CI === 'true') {
1125
zuulConfig.local = false;
1226
zuulConfig.tunnel = {
1327
type: 'ngrok',
14-
authtoken: '6Aw8vTgcG5EvXdQywVvbh_3fMxvd4Q7dcL2caAHAFjV',
15-
proto: 'tcp'
28+
bind_tls: true
1629
};
1730
}
31+
32+
var isPullRequest = process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false';
33+
zuulConfig.browsers = isPullRequest ? browsers.pullRequest : browsers.all;

0 commit comments

Comments
 (0)