forked from rsuite/rsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
56 lines (52 loc) · 1.1 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
/**
* 执行全部测试用例: npm run tdd
* 执行单个组件的测试用例: M=BreadcrumbItem npm run tdd
*/
const webpackConfig = {
output: {
pathinfo: true
},
mode: 'development',
module: {
rules: [
{
test: /\.jsx?$/,
use: ['babel-loader?babelrc'],
exclude: /node_modules/
}
]
}
};
module.exports = config => {
const { env } = process;
const M = env.M ? `${env.M}Spec.js` : 'index.js';
config.set({
basePath: '',
files: [`test/${M}`],
frameworks: ['mocha', 'sinon-chai'],
colors: true,
reporters: ['mocha', 'coverage'],
logLevel: config.LOG_INFO,
preprocessors: {
'test/*.js': ['webpack']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
browsers: env.BROWSER ? env.BROWSER.split(',') : ['Chrome'],
customLaunchers: {
ChromeCi: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
coverageReporter: {
dir: 'coverage',
reporters: [
{ type: 'html' },
{ type: 'lcov', subdir: 'lcov' } // lcov
]
}
});
};