-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.config.js
64 lines (58 loc) · 1.6 KB
/
karma.config.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
var path = require('path');
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
var coverage = process.env.COVERAGE === 'true';
var ci = process.env.NODE_ENV === 'test:ci';
if (coverage) {
console.log('-- recording coverage --');
}
var webpackConfig = require('./webpack.config')[0];
var preprocessors = {};
preprocessors['test/*'] = ['webpack'];
preprocessors['src/*'] = ['webpack'];
module.exports = function (config) {
config.set({
basePath: './',
frameworks: ['chai', 'mocha'],
reporters: getReporters(),
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatchBatchDelay: 300,
files: [
"./dist/**/*.js",
"./test/**/*.js"
],
exclude: [],
preprocessors: preprocessors,
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
coverageReporter: {
reporters: [
{type: 'lcov', dir: 'coverage/', subdir: '.'},
{type: 'json', dir: 'coverage/', subdir: '.'},
{type: 'text-summary'}
]
},
autoWatch: !ci,
browsers: ['Chrome'], //['Firefox'],
singleRun: ci,
browserNoActivityTimeout: 180000,
plugins: [
'karma-webpack',
'karma-mocha',
'karma-chai',
'karma-coverage',
'karma-chrome-launcher',
'karma-firefox-launcher'
]
});
};
function getReporters() {
var reps = ['progress'];
if (coverage) {
reps.push('coverage');
}
return reps;
}