-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathkarma.conf.js
56 lines (52 loc) · 1.12 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',
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
devtool: 'inline-source-map',
entry: __dirname + '/test/index.js',
module: {
rules: [
{
test: /\.tsx?$/,
use: ['babel-loader?babelrc'],
exclude: /node_modules/
}
]
}
};
module.exports = config => {
const { env } = process;
config.set({
basePath: '',
frameworks: ['mocha', 'sinon-chai'],
reporters: ['mocha'],
files: ['test/html/*.html', 'test/index.js'],
port: 9876,
colors: true,
autoWatch: true,
logLevel: config.LOG_INFO,
browsers: env.BROWSER ? env.BROWSER.split(',') : ['Chrome'],
customLaunchers: {
ChromeCi: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
preprocessors: {
'test/html/*.html': 'html2js',
'test/index.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
}
});
};