forked from Chevrotain/chevrotain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma_sauce.conf.js
142 lines (117 loc) · 4.5 KB
/
karma_sauce.conf.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var os = require('os');
var ifaces = os.networkInterfaces();
var ipAddresses = []
// based on http://stackoverflow.com/a/8440736
Object.keys(ifaces).forEach(function(ifname) {
var alias = 0;
ifaces[ifname].forEach(function(iface) {
if ('IPv4' !== iface.family || iface.internal !== false) {
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
return;
}
ipAddresses.push(iface.address);
});
});
module.exports = function(config) {
"use strict";
var fs = require("fs")
var customLaunchers = {
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest'
},
'SL_InternetExplorer': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: 'latest',
platform: 'Windows 10'
},
'SL_EDGE': {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest'
},
'SL_FireFox': {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest',
platform: 'Windows 10'
},
'SL_SAFARI10': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '10.0'
}
}
// Use ENV vars on Travis and sauce.json locally to get credentials
if (!process.env.SAUCE_USERNAME) {
if (!fs.existsSync('sauce.json')) {
console.log('Create a sauce.json with your credentials based on the sauce-sample.json file.');
process.exit(1);
} else {
process.env.SAUCE_USERNAME = require('./sauce').username;
process.env.SAUCE_ACCESS_KEY = require('./sauce').accessKey;
}
}
var sauceConfig = {
testName: 'Chevrotain-CI',
retryLimit: 3,
recordVideo: false,
recordScreenshots: false
}
if (process.env.TRAVIS) {
sauceConfig.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'
}
// TODO: this does not actually seem to work... if it would work we can use filtering by tag name in the badge.
if (process.env.TRAVIS_BRANCH === "master" &&
process.env.TRAVIS_PULL_REQUEST !== "false") {
console.log("Sauce Labs results will be reported in the badge")
sauceConfig.tags = ["master"]
}
config.set({
sauceLabs: sauceConfig,
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: ['mocha', 'chai'],
files: [
'test/test.config.js',
'dev/chevrotainSpecs.js'
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress', 'saucelabs'],
// Hack for SauceLabs seems that Safari and IE-Edge refuse to connect to localhost with SauceLabs connect.
// but will work if given the actual local network IP...
hostname: ipAddresses[0],
// web server port
port: 9979,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: Object.keys(customLaunchers),
customLaunchers: customLaunchers,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 10000000,
browserNoActivityTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};