-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
61 lines (52 loc) · 1.32 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
var path = require('path');
// Reference: http://karma-runner.github.io/0.12/config/configuration-file.html
module.exports = function karmaConfig (config) {
config.set({
frameworks: [
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
'mocha', 'chai', 'es6-shim'
],
/**
* 配置请参考如下链接
* https://github.com/litixsoft/karma-mocha-reporter
*/
reporters: ['mocha'],
files: [
// Grab all files in the app folder that contain .spec.
// 'src/tests.webpack.js'
'test/**/*.spec.js'
],
preprocessors: {
// Reference: http://webpack.github.io/docs/testing.html
// Reference: https://github.com/webpack/karma-webpack
// Convert files with webpack and load sourcemaps
'test/**/*.spec.js': ['webpack']
},
browsers: [
// Run tests using PhantomJS
'PhantomJS'
],
singleRun: true,
webpack: {
resolve: {
root: [
// 增加该配置可以方便require的使用
path.resolve('./src')
]
}
},
// Hide webpack build information from output
webpackMiddleware: {
noInfo: 'errors-only'
},
plugins : [
require('karma-mocha'),
require('karma-chai'),
require('karma-phantomjs-launcher'),
require('karma-webpack'),
require('karma-mocha-reporter'),
require('karma-es6-shim')
]
});
};