-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
87 lines (84 loc) · 1.99 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
84
85
86
87
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const PATHS = {
src: path.resolve(__dirname, 'src'),
assets: path.join(__dirname, 'assets'),
test: path.resolve(__dirname, 'test')
}
module.exports = function (config) {
config.set({
singleRun: true,
browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],
frameworks: ['mocha'],
files: [
'karma.webpack.js'
],
preprocessors: {
'karma.webpack.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'mocha', 'coverage' ],
coverageReporter: {
reporters: [
process.env.TRAVIS
? { type: 'lcov' }
: { type: 'html', dir: 'coverage' },
]
},
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
include: [PATHS.src, PATHS.test],
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ['style', 'css?sourceMap', 'postcss', 'sass?sourceMap'],
include: PATHS.src,
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json'
}
],
preLoaders: [
{
test: /\.jsx?$/,
loader: 'isparta?',
include: PATHS.src,
exclude: /node_modules/
},
{
test: /\.jsx?$/,
loader: 'eslint',
include: PATHS.src,
exclude: /node_modules/
}
]
},
externals: {
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react/addons': true
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('test')
})
]
},
postcss: function() {
return[
autoprefixer()
];
},
webpackServer: {
noInfo: true
}
});
};