Skip to content

Commit

Permalink
Build: include browser tests in travis-ci (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxwolf committed Sep 7, 2016
1 parent fe492e8 commit 4005f31
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 17 deletions.
38 changes: 22 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
language: node_js
node_js:
- '0.10'
- '0.12'
- 'iojs'
- '4'
- '5'
- '6'

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.8
node_js:
- '0.10'
- '0.12'
- iojs
- '4'
- '5'
- '6'
env:
matrix:
- CXX=g++-4.8 TASKS=test:nodejs
matrix:
include:
- node_js: 6
env:
- TASKS=test:nodejs
- EXTRAS=""
global:
- CXX=g++-4.8

- CXX=g++-4.8 TASKS=travis:browser
addons:
firefox: latest
sauce_connect: true
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 5 # give xvfb some time to start
script:
- ./node_modules/.bin/gulp $TASKS $EXTRAS
- ./node_modules/.bin/gulp $TASKS
32 changes: 31 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var ARGV = require("yargs").
var webpack = require("webpack-stream"),
clone = require("lodash.clone"),
gulp = require("gulp"),
gutil = require("gulp-util"),
karma = require("karma"),
merge = require("lodash.merge"),
mocha = require("gulp-mocha"),
Expand Down Expand Up @@ -168,7 +169,10 @@ var KARMA_CONFIG = {
loader: "json"
}
]
}
},
},
webpackMiddleware: {
noInfo: true
},
reporters: ["mocha"],
customLaunchers: {
Expand Down Expand Up @@ -293,6 +297,32 @@ gulp.task("test:browser", function(cb) {
cb);
});

// ## TRAVIS-CI TASKS ###
gulp.task("travis:browser", function(cb) {
if ("true" !== process.env.TRAVIS) {
gutil.log("travis-ci environment not detected");
cb();
return;
}

gutil.log("pull request: ", process.env.TRAVIS_PULL_REQUEST);
gutil.log("job number: ", process.env.TRAVIS_JOB_NUMBER);
if (process.env.SAUCE_USERNAME &&
process.env.SAUCE_ACCESS_KEY &&
"false" === process.env.TRAVIS_PULL_REQUEST) {
ARGV.sauce = true;
merge(KARMA_CONFIG.sauceLabs, {
startConnect: false,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || null
});
} else {
ARGV.sauce = false;
ARGV.browsers="Firefox";
}

runSequence("test:browser", cb);
});

// ### MAIN TASKS ###
gulp.task("test", function(cb) {
runSequence("test:lint",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"gulp-mocha": "^2.0.0",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.7",
"istanbul": "^0.4.0",
"jose-cookbook": "git+https://github.com/ietf-jose/cookbook.git",
"json-loader": "^0.5.4",
Expand Down

0 comments on commit 4005f31

Please sign in to comment.