diff --git a/.travis.yml b/.travis.yml index 5fe83382..8fda8baa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ install: - npm install -g bower - npm install - bower install +before_script: +- export DISPLAY=:99.0 +- sh -e /etc/init.d/xvfb start script: - npm run travis after_script: diff --git a/gulpfile.js b/gulpfile.js index dbc9ca37..0c66962d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,7 +13,7 @@ var uglify = require("gulp-uglify"); var karma = require("gulp-karma"); // Determine if this is being run in Travis -var travis = (process.argv.indexOf('--travis') > -1); +var travis = false; /****************/ @@ -97,6 +97,7 @@ gulp.task("test", function() { return gulp.src(paths.tests.files) .pipe(karma({ configFile: paths.tests.config, + browsers: travis ? ["Firefox"] : ["Chrome"], action: "run" })) .on("error", function(error) { @@ -112,5 +113,11 @@ gulp.task("watch", function() { /* Builds the distribution files */ gulp.task("build", ["scripts"]); -/* Runs the "test" and "scripts" tasks by default */ -gulp.task("default", ["test", "scripts"]); \ No newline at end of file +/* Tasks to be run within Travis CI */ +gulp.task("travis", function() { + travis = true; + gulp.start("build", "test"); +}); + +/* Runs the "scripts" and "test" tasks by default */ +gulp.task("default", ["build", "test"]); diff --git a/package.json b/package.json index 2cbb07f1..189dfeb1 100644 --- a/package.json +++ b/package.json @@ -45,15 +45,16 @@ "gulp-uglify": "^0.2.1", "jshint-stylish": "^0.2.0", "karma": "^0.12.16", + "karma-chrome-launcher": "^0.1.5", "karma-coverage": "^0.2.4", "karma-failed-reporter": "0.0.2", + "karma-firefox-launcher": "^0.1.3", "karma-jasmine": "~0.2.0", - "karma-phantomjs-launcher": "~0.1.4", "karma-spec-reporter": "0.0.13", "streamqueue": "^0.1.1" }, "scripts": { "test": "gulp test", - "travis": "gulp --travis" + "travis": "gulp travis" } } diff --git a/tests/karma.conf.js b/tests/karma.conf.js index bda72e7f..884573df 100644 --- a/tests/karma.conf.js +++ b/tests/karma.conf.js @@ -1,8 +1,6 @@ -// Configuration file for Karma test runner module.exports = function(config) { config.set({ frameworks: ["jasmine"], - browsers: ["PhantomJS"], autowatch: false, singleRun: true, diff --git a/tests/specs/common.spec.js b/tests/specs/common.spec.js index 9c20d614..5d12faa4 100644 --- a/tests/specs/common.spec.js +++ b/tests/specs/common.spec.js @@ -4,9 +4,6 @@ // Override the default timeout interval for Jasmine jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; -// Get a reference to a random demo Firebase -var demoFirebaseUrl = "https://" + generateRandomString() + ".firebaseio-demo.com"; - // React test addon var ReactTestUtils = React.addons.TestUtils; @@ -21,7 +18,7 @@ var invalidBindVars = ["", 1, true, false, [], {}, [1, 2], {a: 1}, null, undefin /* Helper function which runs before each Jasmine test has started */ function beforeEachHelper(done) { // Create a new firebase ref with a new context - firebaseRef = new Firebase(demoFirebaseUrl, Firebase.Context()); + firebaseRef = new Firebase("https://tests.firebaseio.com", Firebase.Context()); // Reset the Firebase firebaseRef.remove(function() {