Skip to content

Commit e7dae19

Browse files
author
jacobawenger
committed
Fixed broken test suite
1 parent 6de5410 commit e7dae19

File tree

5 files changed

+49
-7
lines changed

5 files changed

+49
-7
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ install:
55
- npm install -g bower
66
- npm install
77
- bower install
8+
before_script:
9+
- export DISPLAY=:99.0
10+
- sh -e /etc/init.d/xvfb start
811
script:
912
- npm run travis
1013
after_script:

gulpfile.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var uglify = require("gulp-uglify");
1313
var karma = require("gulp-karma");
1414

1515
// Determine if this is being run in Travis
16-
var travis = (process.argv.indexOf('--travis') > -1);
16+
var travis = false;
1717

1818

1919
/****************/
@@ -39,7 +39,10 @@ var paths = {
3939
},
4040

4141
tests: {
42-
config: "tests/karma.conf.js",
42+
configs: {
43+
local: "tests/karma.conf.js",
44+
travis: "tests/karam-travis.conf.js"
45+
},
4346
files: [
4447
"bower_components/firebase/firebase.js",
4548
"tests/phantomjs-es5-shim.js",
@@ -94,9 +97,10 @@ gulp.task("scripts", function() {
9497

9598
/* Uses the Karma test runner to run the Jasmine tests */
9699
gulp.task("test", function() {
100+
var configFile = travis ? paths.tests.configs.travis : paths.tests.configs.local;
97101
return gulp.src(paths.tests.files)
98102
.pipe(karma({
99-
configFile: paths.tests.config,
103+
configFile: configFile,
100104
action: "run"
101105
}))
102106
.on("error", function(error) {
@@ -112,5 +116,11 @@ gulp.task("watch", function() {
112116
/* Builds the distribution files */
113117
gulp.task("build", ["scripts"]);
114118

115-
/* Runs the "test" and "scripts" tasks by default */
116-
gulp.task("default", ["test", "scripts"]);
119+
/* Tasks to be run within Travis CI */
120+
gulp.task("travis", function() {
121+
travis = true;
122+
gulp.start("build", "test");
123+
});
124+
125+
/* Runs the "scripts" and "test" tasks by default */
126+
gulp.task("default", ["build", "test"]);

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@
4545
"gulp-uglify": "^0.2.1",
4646
"jshint-stylish": "^0.2.0",
4747
"karma": "^0.12.16",
48+
"karma-chrome-launcher": "^0.1.5",
4849
"karma-coverage": "^0.2.4",
4950
"karma-failed-reporter": "0.0.2",
51+
"karma-firefox-launcher": "^0.1.3",
5052
"karma-jasmine": "~0.2.0",
5153
"karma-phantomjs-launcher": "~0.1.4",
5254
"karma-spec-reporter": "0.0.13",
5355
"streamqueue": "^0.1.1"
5456
},
5557
"scripts": {
5658
"test": "gulp test",
57-
"travis": "gulp --travis"
59+
"travis": "gulp travis"
5860
}
5961
}

tests/karma-travis.conf.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Configuration file for Karma test runner
2+
module.exports = function(config) {
3+
config.set({
4+
frameworks: ["jasmine"],
5+
browsers: ["Firefox"],
6+
autowatch: false,
7+
singleRun: true,
8+
9+
preprocessors: {
10+
"../src/*.js": "coverage"
11+
},
12+
13+
reporters: ["spec", "failed", "coverage"],
14+
coverageReporter: {
15+
reporters: [
16+
{
17+
type: "lcovonly",
18+
dir: "coverage",
19+
subdir: "."
20+
},
21+
{
22+
type: "text-summary"
23+
}
24+
]
25+
},
26+
});
27+
};

tests/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = function(config) {
33
config.set({
44
frameworks: ["jasmine"],
5-
browsers: ["PhantomJS"],
5+
browsers: ["Chrome"],
66
autowatch: false,
77
singleRun: true,
88

0 commit comments

Comments
 (0)