Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Update zuul config to speed up tests in browser #1052

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,5 @@ notifications:
irc: irc.freenode.org#socket.io
matrix:
include:
- node_js: '0.10'
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
- node_js: '0.10'
env: BROWSER_NAME=safari BROWSER_VERSION=latest
- node_js: '0.12'
env: BROWSER_NAME=firefox BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 10"
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=6
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=7
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=8
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=9
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=10 BROWSER_PLATFORM="Windows 2012"
- node_js: '0.10'
env: BROWSER_NAME=ie BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 2012"
# - node_js: '0.12'
# env: BROWSER_NAME=microsoftedge BROWSER_VERSION=13 BROWSER_PLATFORM="Windows 10"
- node_js: '0.10'
env: BROWSER_NAME=iphone BROWSER_VERSION=8.4
- node_js: '0.10'
env: BROWSER_NAME=iphone BROWSER_VERSION=9.2
- node_js: '0.10'
env: BROWSER_NAME=android BROWSER_VERSION=4.3
- node_js: '0.10'
env: BROWSER_NAME=android BROWSER_VERSION=4.4
- node_js: '0.10'
env: BROWSER_NAME=android BROWSER_VERSION=5.1
- node_js: '0.10'
env: BROWSER_NAME=android BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSERS=1
15 changes: 2 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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 @@ -68,18 +68,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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"istanbul": "0.4.2",
"mocha": "2.3.4",
"socket.io": "1.7.2",
"socket.io-browsers": "^1.0.0",
"strip-loader": "0.1.2",
"text-blob-builder": "0.0.1",
"uglify-js": "2.6.1",
Expand Down
34 changes: 27 additions & 7 deletions zuul.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
'use strict';

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

var zuulConfig = module.exports = {
ui: 'mocha-bdd',
server: './test/support/server.js',
tunnel: {
type: 'ngrok',
authtoken: '6Aw8vTgcG5EvXdQywVvbh_3fMxvd4Q7dcL2caAHAFjV',
proto: 'tcp'
},
builder: 'zuul-builder-webpack',
webpack: require('./support/webpack.config.js')
webpack: require('./support/webpack.config.js'),

// 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
};

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

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