-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
80 lines (75 loc) · 2.28 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
var webpackConfig = require('./webpack.config');
webpackConfig.devtool = 'inline-source-map';
var type = process.env.npm_lifecycle_event;
if(type) {
console.log('script type: ' + type);
} else {
type = 'test';
console.log('no npm_lifecycle_event given, ASSUMING: ' + type);
}
module.exports = function (config) {
var configuration = {
// basePath: '.',
browsers: ['chrome_large'],
customLaunchers: {
chrome_large: {
base: 'Chrome',
flags: [
'--window-size=1100,600',
'--window-position=-0,0'
]
},
Chrome_Travis_CI_large_no_sandbox: {
base: 'Chrome',
flags: [
'--window-size=1100,600',
'--window-position=-0,0',
'--no-sandbox'
]
}
},
files: [
'test/runner.js'
],
plugins: [
'karma-chrome-launcher',
'karma-chai',
'karma-sinon',
'karma-sinon-chai',
'karma-mocha',
'karma-sourcemap-loader',
'karma-webpack',
'karma-mocha-reporter'
],
frameworks: [ 'chai', 'mocha', 'sinon', 'sinon-chai' ],
preprocessors: {
'test/**/*': ['webpack', 'sourcemap'],
'src/**/*': ['webpack', 'sourcemap']
},
reporters: [ 'progress', 'mocha' ],
singleRun: false,
webpack: webpackConfig,
webpackServer: {
noInfo: true
}
};
if (process.env.TRAVIS) {
configuration.browsers = ['Chrome_Travis_CI_large_no_sandbox'];
}
if (type === 'coverage') {
webpackConfig.module.postLoaders = [{
test: /\.jsx|\.js$/,
exclude: /(test|libs|node_modules|bower_components)\//,
loader: 'istanbul-instrumenter'
}];
configuration.files = ['test/runner.coverage.js'];
configuration.plugins.push('karma-coverage');
configuration.coverageReporter = {
type : 'html',
dir : 'coverage/'
};
configuration.reporters.push('coverage');
configuration.singleRun = true;
}
config.set(configuration);
};