-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathkarma.conf.js
More file actions
53 lines (52 loc) · 1.79 KB
/
karma.conf.js
File metadata and controls
53 lines (52 loc) · 1.79 KB
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
// see https://github.com/lelandrichardson/enzyme-example-karma-webpack/blob/master/karma.conf.js (but note extra externals with 15.0.0 React)
module.exports = function (config) {
config.set({
browsers: ['Chrome'],
singleRun: true,
frameworks: ['mocha'],
files: [
'tests.webpack.js'
],
plugins: [
'karma-chrome-launcher',
'karma-mocha',
'karma-mocha-reporter',
'karma-sourcemap-loader',
'karma-webpack'
],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap']
},
reporters: ['mocha'],
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.js$/, exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
},
//See https://github.com/airbnb/enzyme/issues/309 as to why json loader is needed.
//I had to add this when I tried to use enzyme's 'render', which uses Cherrio
{
test: /\.json$/,
loader: 'json',
}
]
},
//Needed for enzyme working with webpack & React 15.0.x. See http://airbnb.io/enzyme/docs/guides/webpack.html#react-15-compatability
externals: {
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
},
watch: true
},
webpackServer: {
noInfo: true
},
});
};