Skip to content

Commit

Permalink
[test] Update travis configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Mar 1, 2018
1 parent e27f38b commit 3d8f24e
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 62 deletions.
52 changes: 18 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,26 @@
language: node_js
node_js:
- '4'
- '6'
- '8'
- '4'
- '6'
- '8'
- node
sudo: false
git:
depth: 1
notifications:
irc: irc.freenode.org#socket.io
irc: 'irc.freenode.org#socket.io'
matrix:
include:
- node_js: 'node'
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=safari BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=firefox BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=8
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=9
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=10
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=11
- node_js: 'node'
env: BROWSER_NAME=microsoftedge BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=8.4
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=9.2
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=10.0
- node_js: 'node'
env: BROWSER_NAME=android BROWSER_VERSION=4.4
- node_js: 'node'
env: BROWSER_NAME=android BROWSER_VERSION=5.1
- node_js: 'node'
env: BROWSER_NAME=ipad BROWSER_VERSION=9.3
- node_js: 'node'
env: BROWSER_NAME=ipad BROWSER_VERSION=10.0
- node_js: node
env: BROWSERS=1
cache:
directories:
- node_modules
env:
global:
- secure: >-
QYaPt9wtF7Vm+kRPaGNAaCRP/E74gjxA7T0k1GqPYIs2xDiuhU/ef03pzWIjBB+6z0GGnsQ4rG+6JlM1lsthTMEDcegbp6/XKZkqZqWUaJmCy7U41J2mJutwli6ZV9VAqh5pi0mfe5elAqeh/fx+GhFbtu6JzBQkpW58OytiP1Y=
- secure: >-
pa7ocLVb5BJPCIC1cnGWWC0nGOKywR6Ac/QuiX1VD1SUt0XxpPVrbBzdgfHIMD0MCJ8F8xIlu2IPgp0O/a6c+Nj2V825Up5yKD/H0k1FKQ/4jp9aInV1VDFkKmoWdQcpCSaHq9HXJH58Bm4lpNyJdCydMpGOjZmSfs/ZGbzNN1Y=
- secure: >-
Og1/VRKnYHFNIj5rFhn/MIWvk8TBJ4CrNwffeBsUmusPJzyeATjkD8ZjGHD3jcjUcI3m4ihHe5al+WOt8GT9pUABDbuvFJXCBtNMGlo0URRlFu+oc3Qi3Ux8gJ/2317HDx9RNOJ+AC8EcBym49BDTm93rHc80ZLBVZZDS2pUU6o=
15 changes: 2 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const TEST_FILE = './test/index.js';
const TEST_SUPPORT_SERVER_FILE = './test/support/server.js';

gulp.task('test', ['lint'], function () {
if (process.env.hasOwnProperty('BROWSER_NAME')) {
if (process.env.hasOwnProperty('BROWSERS')) {
return testZuul();
} else {
return testNode();
Expand All @@ -63,18 +63,7 @@ gulp.task('lint', function () {
// runs zuul through shell process
function testZuul () {
const ZUUL_CMD = './node_modules/zuul/bin/zuul';
const args = [
'--browser-name',
process.env.BROWSER_NAME,
'--browser-version',
process.env.BROWSER_VERSION
];
if (process.env.hasOwnProperty('BROWSER_PLATFORM')) {
args.push('--browser-platform');
args.push(process.env.BROWSER_PLATFORM);
}
args.push(TEST_FILE);
const zuulChild = child.spawn(ZUUL_CMD, args, { stdio: 'inherit' });
const zuulChild = child.spawn(ZUUL_CMD, [TEST_FILE], { stdio: 'inherit' });
zuulChild.on('exit', function (code) { process.exit(code); });
return zuulChild;
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"object-component": "0.0.3",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"socket.io-parser": "~3.1.1",
"socket.io-parser": "3.1.2",
"to-array": "0.1.4"
},
"devDependencies": {
Expand All @@ -49,6 +49,7 @@
"istanbul": "^0.4.5",
"mocha": "^3.3.0",
"socket.io": "2.0.4",
"socket.io-browsers": "^1.0.0",
"strip-loader": "0.1.2",
"text-blob-builder": "0.0.1",
"webpack-merge": "4.1.2",
Expand Down
4 changes: 1 addition & 3 deletions support/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

var webpack = require('webpack');

module.exports = {
name: 'default',
entry: './lib/index.js',
Expand All @@ -17,7 +15,7 @@ module.exports = {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
loader: 'babel-loader',
query: { presets: ['es2015'] }
}, {
test: /\json3.js/,
Expand Down
4 changes: 2 additions & 2 deletions support/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var baseConfig = require('./webpack.config.dev.js')
var baseConfig = require('./webpack.config.dev.js');

module.exports = merge(baseConfig, {
output: {
Expand All @@ -21,5 +21,5 @@ module.exports = merge(baseConfig, {
beautify: false
}
})
],
]
});
4 changes: 2 additions & 2 deletions support/webpack.config.slim.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ module.exports = {
},
devtool: 'source-map',
plugins: [
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/support/noop.js'),
new webpack.NormalModuleReplacementPlugin(/debug/, process.cwd() + '/support/noop.js')
],
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
loader: 'babel-loader',
query: { presets: ['es2015'] }
}, {
test: /\json3.js/,
Expand Down
4 changes: 2 additions & 2 deletions support/webpack.config.slim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var baseConfig = require('./webpack.config.slim.dev.js')
var baseConfig = require('./webpack.config.slim.dev.js');

module.exports = merge(baseConfig, {
output: {
Expand All @@ -10,5 +10,5 @@ module.exports = merge(baseConfig, {
},
plugins: [
new webpack.optimize.UglifyJsPlugin()
],
]
});
4 changes: 3 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
require('./support/env');

// whitelist some globals to avoid warnings
global.___eio = null;
if (global.mocha) {
global.mocha.globals(['___eio', 'eio_iframe_*']);
}

require('./url');

Expand Down
24 changes: 20 additions & 4 deletions zuul.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
'use strict';

var browsers = require('socket.io-browsers');

var zuulConfig = module.exports = {
ui: 'mocha-bdd',

// test on localhost by default
local: true,

concurrency: 2, // ngrok only accepts two tunnels by default
// if browser does not sends output in 120s since last output:
// stop testing, something is wrong
browser_output_timeout: 120 * 1000,
browser_open_timeout: 60 * 4 * 1000,
// we want to be notified something is wrong asap, so no retry
browser_retries: 1,

server: './test/support/server.js',
local: true, // test on localhost by default
builder: 'zuul-builder-webpack',
webpack: require('./support/webpack.config.js')
webpack: require('./support/webpack.config.dev.js')
};

if (process.env.CI === 'true') {
zuulConfig.local = false;
zuulConfig.tunnel = {
type: 'ngrok',
authtoken: '6Aw8vTgcG5EvXdQywVvbh_3fMxvd4Q7dcL2caAHAFjV',
proto: 'tcp'
bind_tls: true
};
}

var isPullRequest = process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false';
zuulConfig.browsers = isPullRequest ? browsers.pullRequest : browsers.all;

0 comments on commit 3d8f24e

Please sign in to comment.