forked from yqz0203/electron-react-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
83 lines (71 loc) · 1.79 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
81
82
83
// Karma configuration
// Generated on Fri Aug 04 2017 15:54:53 GMT+0800 (CST)
const webpack = require('webpack')
module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: [
{
pattern: 'test/**/*.spec.js',
watched: false,
include: true
}
],
exclude: [
],
preprocessors: {
'./app/renderer/**/*.jsx': ['webpack', 'sourcemap', 'coverage'],
'./test/**/*.spec.js': ['webpack', 'sourcemap']
},
singleRun: process.env.NODE_ENV === 'production',
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'html',
dir: './coverage/'
},
// webpack配置
webpack: {
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js(x)?$/,
exclude: /(node_modules|bower_components)/,
use: ['babel-loader', 'isparta-instrumenter-loader']
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(png|jpg|gif|webp)$/,
use: ['url-loader?limit=10240']
}
]
},
externals: {
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react-addons-test-utils': 'react-dom',
}
},
// 只显示错误信息,不显示打包信息
webpackMiddleware: {
stats: 'errors-only'
},
browsers: ['Chrome'],
plugins: [
'karma-coverage',
'karma-mocha',
'karma-chrome-launcher',
'karma-sourcemap-loader',
// 'karma-phantomjs-launcher',
'karma-webpack'
]
})
}