-
Notifications
You must be signed in to change notification settings - Fork 5
/
karma.conf.js
51 lines (44 loc) · 1.49 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
const webpackConfig = require('./webpack.config')(undefined, {mode: 'development'});
webpackConfig.mode = 'development';
module.exports = (config) => {
var reporters = ['mocha', 'bamboo'];
if(config.coverage){
reporters = ['coverage'];
webpackConfig[0].module.rules.forEach(rule=>{
if(rule.use.loader === 'babel-loader'){
rule.use.options.plugins = rule.use.options.plugins || [];
rule.use.options.plugins.push(["istanbul", {"exclude": ["test/**/*.js"]}]);
}
})
}
config.set({
frameworks: ['mocha'],
files: [
{ pattern: 'src/**/*.js' },
{ pattern: 'test/**/*.js' }
],
preprocessors: {
'src/**/*.js': ['webpack', 'sourcemap'],
'test/**/*.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig[0],
reporters: reporters,
browsers: ['ChromeHeadlessNoSandbox'],
//browsers: ['Safari'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
coverageReporter: {
reporters: [
{type: 'text'},
{type: 'html'},
{type: 'lcov', dir: 'coverage/lcov', subdir: '.', file: 'lcov.dat'},
{type: 'clover', dir: 'coverage', subdir: '.', file: 'clover.xml'}
]
},
singleRun: true
});
};