-
Notifications
You must be signed in to change notification settings - Fork 387
/
Gruntfile.js
98 lines (97 loc) · 3.75 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
'use strict';
module.exports = function (grunt) {
var browsers = [
{ browserName: 'firefox', version: '19', platform: 'XP' },
{ browserName: 'firefox', platform: 'linux' },
{ browserName: 'firefox', platform: 'OS X 10.10' },
{ browserName: 'chrome', platform: 'linux' },
{ browserName: 'chrome', platform: 'OS X 10.9' },
{ browserName: 'chrome', platform: 'XP' },
{ browserName: 'internet explorer', platform: 'Windows 8.1', version: '11' },
{ browserName: 'internet explorer', platform: 'WIN8', version: '10' },
{ browserName: 'internet explorer', platform: 'VISTA', version: '9' },
{ browserName: 'safari', platform: 'OS X 10.6' },
{ browserName: 'safari', platform: 'OS X 10.8' },
{ browserName: 'safari', platform: 'OS X 10.9' },
{ browserName: 'safari', platform: 'OS X 10.10' },
{ browserName: 'iphone', platform: 'OS X 10.9', version: '7.1' },
{ browserName: 'android', platform: 'Linux', version: '4.4' },
];
var extraBrowsers = [
{ browserName: 'firefox', platform: 'linux', version: '30' },
{ browserName: 'firefox', platform: 'linux', version: '25' },
{ browserName: 'iphone', platform: 'OS X 10.8', version: '6.1' },
{ browserName: 'iphone', platform: 'OS X 10.8', version: '5.1' },
{ browserName: 'android', platform: 'Linux', version: '4.2' },
// XXX haven't investigated these:
// { browserName: 'opera', platform: 'Windows 7', version: '12' },
// { browserName: 'opera', platform: 'Windows 2008', version: '12' }
// { browserName: 'iphone', platform: 'OS X 10.6', version: '4.3' },
// { browserName: 'android', platform: 'Linux', version: '4.0' },
];
if (grunt.option('extra')) {
browsers = browsers.concat(extraBrowsers);
}
grunt.initConfig({
connect: {
server: {
options: {
base: '',
port: 9999,
useAvailablePort: true
}
}
},
'saucelabs-mocha': {
all: {
options: {
urls: (function () {
var urls = ['http://localhost:9999/test/'];
if (grunt.option('extra')) {
urls.push('http://localhost:9999/test-sham/');
}
return urls;
}()),
// tunnelTimeout: 5,
build: process.env.TRAVIS_BUILD_NUMBER,
tunneled: !process.env.SAUCE_HAS_TUNNEL,
identifier: process.env.TRAVIS_JOB_NUMBER,
sauceConfig: {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
},
// concurrency: 3,
browsers: browsers,
testname: (function () {
var testname = 'mocha';
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
testname += ' (PR ' + process.env.TRAVIS_PULL_REQUEST + ')';
}
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
testname += ' (branch ' + process.env.TRAVIS_BRANCH + ')';
}
return testname;
}()),
tags: (function () {
var tags = [];
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false') {
tags.push('PR-' + process.env.TRAVIS_PULL_REQUEST);
}
if (process.env.TRAVIS_BRANCH && process.env.TRAVIS_BRANCH !== 'false') {
tags.push(process.env.TRAVIS_BRANCH);
}
return tags;
}())
}
}
},
watch: {}
});
// Loading dependencies
for (var key in grunt.file.readJSON('package.json').devDependencies) {
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
grunt.loadNpmTasks(key);
}
}
grunt.registerTask('dev', ['connect', 'watch']);
grunt.registerTask('sauce', ['connect', 'saucelabs-mocha']);
};