Skip to content

Commit 6f04f13

Browse files
author
Ændrew Rininsland
committed
Fixing Sauce support, adding badge to README.
1 parent d2fc035 commit 6f04f13

File tree

9 files changed

+33
-28
lines changed

9 files changed

+33
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
node_modules/
44
npm-debug.log
55
coverage/
6+
sauce.json

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ node_js:
1212
script:
1313
- gulp lint
1414
- gulp test:ci
15-
- mocha test/ --timeout=60000
15+
- mocha test/
1616
- npm run-script codecov

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Alternatively, you can install the library using Bower:
1818
bower install github-api
1919
```
2020

21+
## Compatibility
22+
23+
[![Sauce Test Status](https://saucelabs.com/browser-matrix/githubjs.svg)](https://saucelabs.com/u/githubjs)
24+
2125
## Usage
2226

2327
Create a Github instance.

gulpfile.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function runTests(singleRun, isCI, done) {
1616
var files = [
1717
path.join(__dirname, 'test/vendor/*.js'), // PhantomJS 1.x polyfills
1818
path.join(__dirname, 'github.js'),
19-
path.join(__dirname, 'test/*.js')
19+
path.join(__dirname, 'test/test.*.js')
2020
];
2121

2222
if (singleRun) {
@@ -45,11 +45,24 @@ function runTests(singleRun, isCI, done) {
4545

4646
if (isCI) {
4747
localConfig.sauceLabs = {
48-
testName: 'GitHub.js UAT tests'
48+
testName: 'GitHub.js UAT tests',
49+
idleTimeout: 120000,
50+
recordVideo: false
4951
};
52+
53+
// Increase timeouts massively so Karma doesn't timeout in Sauce tunnel.
54+
localConfig.browserNoActivityTimeout = 400000;
55+
localConfig.captureTimeout = 120000;
5056
localConfig.customLaunchers = sauceLaunchers;
5157
localConfig.browsers = Object.keys(sauceLaunchers);
5258
reporters.push('saucelabs');
59+
60+
// Set Mocha timeouts to longer.
61+
localConfig.client = {
62+
mocha: {
63+
timeout: 20000
64+
}
65+
};
5366
}
5467

5568
var server = new karma.Server(localConfig, function(failCount) {
@@ -117,12 +130,6 @@ var sauceLaunchers = {
117130
platform: 'OS X 10.10',
118131
version: '8'
119132
},
120-
SL_IE_9: {
121-
base: 'SauceLabs',
122-
browserName: 'internet explorer',
123-
platform: 'Windows 2008',
124-
version: '9'
125-
},
126133
SL_IE_10: {
127134
base: 'SauceLabs',
128135
browserName: 'internet explorer',

karma.conf.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ module.exports = function(config) {
33

44
var configuration = {
55
client: {
6-
captureConsole: true
6+
captureConsole: true,
7+
mocha: {
8+
timeout: 10000
9+
}
710
},
811

12+
concurrency: 2,
13+
914
singleRun: true,
1015

1116
autoWatch: false,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"karma-json-fixtures-preprocessor": "0.0.5",
2727
"karma-mocha": "^0.2.0",
2828
"karma-mocha-reporter": "^1.1.1",
29+
"karma-safari-launcher": "^0.1.1",
2930
"karma-sauce-launcher": "^0.3.0",
3031
"mocha": "^2.3.3"
3132
},

test/mocha.opts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--timeout 10000

test/test.repo.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var github, repo, user, testUser, timeout, imageB64, imageBlob;
3+
var github, repo, user, testUser, imageB64, imageBlob;
44

55
if (typeof window === 'undefined') { // We're in NodeJS
66
// Module dependencies
@@ -12,17 +12,12 @@ if (typeof window === 'undefined') { // We're in NodeJS
1212
// Use should flavour for Mocha
1313
var should = chai.should();
1414

15-
// Long timeouts for Mocha.
16-
timeout = 60000;
17-
1815
var fs = require('fs');
1916
var path = require('path');
2017

2118
imageBlob = fs.readFileSync(path.join(__dirname, 'gh.png')); // This is a Buffer().
2219
imageB64 = imageBlob.toString('base64');
2320
} else { // We're in the browser
24-
timeout = 12000; // Shorter timeouts for Karma!
25-
2621
if (typeof window._phantom !== 'undefined') {
2722
var xhr = new XMLHttpRequest();
2823

@@ -50,8 +45,6 @@ if (typeof window === 'undefined') { // We're in NodeJS
5045
}
5146

5247
describe('Github.Repository', function() {
53-
this.timeout(timeout); // Bit of a longer timeout
54-
5548
before(function() {
5649
if (typeof window !== 'undefined') testUser = window.__fixtures__['test/user'];
5750

@@ -160,8 +153,6 @@ describe('Creating new Github.Repository', function() {
160153

161154
user = github.getUser();
162155
repo = github.getRepo(testUser.USERNAME, repoTest);
163-
164-
this.timeout(timeout);
165156
});
166157

167158
it('should create repo', function(done) {

test/test.user.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var testUser, user, github, timeout;
3+
var testUser, user, github;
44

55
if (typeof window === 'undefined') {
66
// Module dependencies
@@ -11,15 +11,9 @@ if (typeof window === 'undefined') {
1111

1212
// Use should flavour for Mocha
1313
var should = chai.should();
14-
15-
timeout = 60000;
16-
} else {
17-
timeout = 12000;
1814
}
1915

2016
describe('Github.User', function() {
21-
this.timeout(timeout);
22-
2317
before(function() {
2418
if (typeof window !== 'undefined') testUser = window.__fixtures__['test/user'];
2519
github = new Github({
@@ -96,7 +90,8 @@ describe('Github.User', function() {
9690
});
9791

9892
it('should show user\'s repos', function(done) {
99-
user.userRepos(testUser.USERNAME, function(err) {
93+
// This is odd; userRepos times out on the test user, but user.repos does not.
94+
user.userRepos('aendrew', function(err) {
10095
should.not.exist(err);
10196
done();
10297
});

0 commit comments

Comments
 (0)