forked from popcodeorg/popcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
90 lines (68 loc) · 1.99 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
/* eslint-env node */
/* eslint-disable import/unambiguous */
/* eslint-disable import/no-commonjs */
const webpackConfiguration = require('./webpack.config.js');
const isCi = Boolean(process.env.TRAVIS);
const browserStackAvailable = Boolean(process.env.BROWSER_STACK_ACCESS_TOKEN);
const allBrowsers = [
['Chrome', '53', 'Windows', '10'],
['Firefox', '48', 'Windows', '10'],
['IE', '11', 'Windows', '10'],
['Chrome', '53', 'OS X', 'Sierra'],
['Firefox', '48', 'OS X', 'Sierra'],
];
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['tap', 'sinon'],
files: ['test/index.js'],
preprocessors: {
'test/index.js': ['webpack', 'sourcemap'],
},
webpack: webpackConfiguration('test'),
webpackMiddleware: {
stats: 'errors-only',
},
reporters: ['dots'],
port: 9876,
colors: true,
logLevel: config.LOG_WARN,
browsers: ['Chrome'],
concurrency: Infinity,
browserConsoleLogOptions: {
level: config.LOG_WARN,
},
});
if (browserStackAvailable) {
const customLaunchers = {};
allBrowsers.forEach((browser) => {
customLaunchers[`browserStack${browser[0]}${browser[2]}`] = {
base: 'BrowserStack',
browser: browser[0],
browser_version: browser[1], // eslint-disable-line camelcase
os: browser[2],
os_version: browser[3], // eslint-disable-line camelcase
};
});
config.set({
browserStack: {
username: process.env.BROWSER_STACK_USERNAME,
accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
},
browserNoActivityTimeout: 60000,
customLaunchers,
browsers: Reflect.getOwnPropertyNames(customLaunchers),
reporters: ['dots', 'BrowserStack'],
});
} else if (isCi) {
config.set({
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
},
},
});
}
};