From 8a7a36ef2837076f28b0cbfd3c4144378f444fda Mon Sep 17 00:00:00 2001 From: Shahar Soel Date: Fri, 25 Dec 2015 22:33:40 +0200 Subject: [PATCH] Add Chrome + Firefox tests (karma) during Travis CI-build. fixes #110 --- .travis.yml | 11 ++++++++++- gruntfile.js | 5 +++-- karma.conf.js | 10 ++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 318c99f756..fb18b75e64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: node_js +sudo: required +dist: trusty cache: directories: - node_modules @@ -20,13 +22,20 @@ matrix: env: CXX=g++-4.8 GRUNT_TASK=integration_tests - node_js: "0.10" env: CXX=g++-4.8 GRUNT_TASK=integration_tests + - node_js: "5" + env: CXX=g++-4.8 GRUNT_TASK=browsers_tests addons: apt: sources: - ubuntu-toolchain-r-test packages: - g++-4.8 -before_install: npm install -g grunt-cli bower + firefox: latest +before_install: + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - npm install -g grunt-cli bower install: - npm install - bower install diff --git a/gruntfile.js b/gruntfile.js index ed92dca171..02186da7bd 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -75,10 +75,10 @@ module.exports = function(grunt) { dev_build: {}, - tests_on_browsers: { + browsers_tests: { options: { files: ['bower_components/lodash/lodash.js', 'test.config.js', 'bin/chevrotain.js', 'bin/chevrotainSpecs.js'], - browsers: ['Chrome', 'Firefox', 'IE'] + browsers: ['Chrome_travis_ci', "Firefox"] } } }, @@ -362,6 +362,7 @@ module.exports = function(grunt) { grunt.registerTask('build_test', buildTestTasks) grunt.registerTask('unit_tests', unitTestsTasks) grunt.registerTask('integration_tests', integrationTestsTasks) + grunt.registerTask('browsers_tests', "karma:browsers_tests") grunt.registerTask('dev_build_test', [ 'clean:dev', diff --git a/karma.conf.js b/karma.conf.js index 64e3195a7b..eaef582739 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,4 +1,3 @@ -/*global module process */ var specsFiles = require('./scripts/findSpecs')("bin/gen/test/", "test") var findRefs = require('./scripts/findRefs') var _ = require('lodash') @@ -10,7 +9,7 @@ coreIncludes = _.reject(coreIncludes, function(srcFile) { coreIncludes = _.map(coreIncludes, function(srcFile) { var fixedPath = srcFile.replace('src', 'bin/gen/src') - var fixedSuffix = fixedPath.replace('.ts', '.js') + var fixedSuffix = fixedPath.replace('.ts', '.js') return fixedSuffix }) @@ -64,6 +63,13 @@ module.exports = function(config) { // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) browsers: ['Chrome'], + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + // If browser does not capture in given timeout [ms], kill it captureTimeout: 10000000, browserNoActivityTimeout: 60000,