forked from reactjs/react-modal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkarma.conf.js
128 lines (98 loc) · 2.7 KB
/
karma.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
const webpackTestConfig = require('./webpack.test.config');
module.exports = function karmaConfig (config) {
let browsers = [];
const customLaunchers = {};
const reporters = [];
function createCustomLauncher (browser, version, platform) {
return {
base: 'SauceLabs',
browserName: browser,
version,
platform
};
}
if (process.env.SAUCE_USERNAME || process.env.SAUCE_ACCESS_KEY) {
const OPTIONS = [
'SAUCE_CHROME',
'SAUCE_FIREFOX',
'SAUCE_SAFARI',
'SAUCE_IE',
'SAUCE_EDGE',
];
let runAll = true;
OPTIONS.forEach((opt) => {
if (process.env[opt]) {
runAll = false;
}
});
// Chrome
if (runAll || process.env.SAUCE_CHROME) {
customLaunchers.SL_Chrome = createCustomLauncher('chrome');
}
// Firefox
if (runAll || process.env.SAUCE_FIREFOX) {
customLaunchers.SL_Firefox = createCustomLauncher('firefox');
}
// Safari
if (runAll || process.env.SAUCE_SAFARI) {
customLaunchers.SL_Safari10 = createCustomLauncher('safari', 10);
customLaunchers.SL_Safari9 = createCustomLauncher('safari', 9);
}
// IE
if (runAll || process.env.SAUCE_IE) {
customLaunchers.SL_IE11 = createCustomLauncher('internet explorer', 11, 'Windows 10');
}
// Edge
if (runAll || process.env.SAUCE_EDGE) {
customLaunchers.SL_Edge = createCustomLauncher('microsoftedge', null, 'Windows 10');
}
browsers = Object.keys(customLaunchers);
reporters.push('saucelabs');
} else {
browsers = [(process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome'];
}
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'specs/spec_index.js'
],
preprocessors: {
'specs/spec_index.js': ['webpack', 'sourcemap']
},
webpack: webpackTestConfig,
webpackMiddleware: {
stats: 'errors-only'
},
reporters: ['mocha', 'coverage'].concat(reporters),
mochaReporter: {
showDiff: true
},
coverageReporter: {
type: 'lcov',
dir: 'coverage/',
subdir: '.'
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers,
customLaunchers,
// Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
captureTimeout: 4 * 60 * 1000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 1,
browserNoActivityTimeout: 4 * 60 * 1000,
singleRun: (process.env.CONTINUOUS_INTEGRATION),
// SauceLabs config
sauceLabs: {
recordScreenshots: false,
connectOptions: {
port: 5757,
logfile: 'sauce_connect.log'
},
public: 'public'
}
});
};