Fixed broken test suite

This commit is contained in:
jacobawenger
2014-10-22 15:10:45 -07:00
parent 6de541060d
commit e7dae19d9f
5 changed files with 49 additions and 7 deletions

View File

@@ -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:

View File

@@ -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;
/****************/
@@ -39,7 +39,10 @@ var paths = {
},
tests: {
config: "tests/karma.conf.js",
configs: {
local: "tests/karma.conf.js",
travis: "tests/karam-travis.conf.js"
},
files: [
"bower_components/firebase/firebase.js",
"tests/phantomjs-es5-shim.js",
@@ -94,9 +97,10 @@ gulp.task("scripts", function() {
/* Uses the Karma test runner to run the Jasmine tests */
gulp.task("test", function() {
var configFile = travis ? paths.tests.configs.travis : paths.tests.configs.local;
return gulp.src(paths.tests.files)
.pipe(karma({
configFile: paths.tests.config,
configFile: configFile,
action: "run"
}))
.on("error", function(error) {
@@ -112,5 +116,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"]);
/* 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"]);

View File

@@ -45,8 +45,10 @@
"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",
@@ -54,6 +56,6 @@
},
"scripts": {
"test": "gulp test",
"travis": "gulp --travis"
"travis": "gulp travis"
}
}

View File

@@ -0,0 +1,27 @@
// Configuration file for Karma test runner
module.exports = function(config) {
config.set({
frameworks: ["jasmine"],
browsers: ["Firefox"],
autowatch: false,
singleRun: true,
preprocessors: {
"../src/*.js": "coverage"
},
reporters: ["spec", "failed", "coverage"],
coverageReporter: {
reporters: [
{
type: "lcovonly",
dir: "coverage",
subdir: "."
},
{
type: "text-summary"
}
]
},
});
};

View File

@@ -2,7 +2,7 @@
module.exports = function(config) {
config.set({
frameworks: ["jasmine"],
browsers: ["PhantomJS"],
browsers: ["Chrome"],
autowatch: false,
singleRun: true,