-
Notifications
You must be signed in to change notification settings - Fork 2
/
karma.conf.js
executable file
·63 lines (58 loc) · 1.58 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
let webpackConfig = require('./webpack.config.js');
//Need to remove externals otherwise they won't be included in test
delete webpackConfig.externals;
// Need to define inline source maps when using karma
webpackConfig.devtool = 'inline-source-map';
const isWindows = /^win/.test(process.platform);
const isMacOS = /^darwin/.test(process.platform);
// Create custom launcher in case running with Travis
const customLaunchers = {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required']
}
};
const launchers = {
Chrome_browser: {
base: 'Chrome',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required']
}
};
module.exports = function (config) {
let karmaConf = {
logLevel: config.LOG_INFO,
customLaunchers: launchers,
browsers: ['Chrome_browser', 'Firefox'],
concurrency: 1,
singleRun: true,
colors: true,
frameworks: ['mocha'],
files: ['test/setup/karma.js'],
preprocessors: {
'src/**/*.js': ['webpack', 'sourcemap'],
'test/setup/karma.js': ['webpack', 'sourcemap']
},
reporters: ['mocha', 'coverage'],
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
client: {
mocha: {
reporter: 'html',
timeout: 5000
}
}
};
if (process.env.TRAVIS) {
karmaConf.customLaunchers = customLaunchers;
karmaConf.browsers = ['Chrome_travis_ci'];
} else {
if (isWindows) {
karmaConf.browsers.push('IE');
} else if (isMacOS) {
karmaConf.browsers.push('Safari');
}
}
config.set(karmaConf);
};