-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.test.js
49 lines (45 loc) · 1.44 KB
/
webpack.config.test.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
var webpack = require('webpack');
var path = require('path');
var jsLoader = require('./webpack/loader.js.js');
var jsxLoader = require('./webpack/loader.jsx.js');
var cssLoader = require('./webpack/loader.css.js');
var scssLoader = require('./webpack/loader.scss.js');
var svgLoader = require('./webpack/loader.svg.js');
var alias = require('./webpack/alias.js');
var extensions = require('./webpack/extensions.js');
// add an addition alias for sinon
alias.sinon = 'sinon/pkg/sinon';
// setup the loader plugins
var loaderPlugins = [
['rewire', { 'exclude': ['**/*.spec.*'] } ],
['istanbul', { 'exclude': ['**/*.spec.*'] } ]
];
// append the rewire and istandul plugins for js and jsx
// TODO: allow an option to not run coverage for debugging
jsLoader.query.plugins = loaderPlugins;
jsxLoader.query.plugins = loaderPlugins;
module.exports = {
entry: ['babel-polyfill'],
resolve: {
alias: alias,
extensions: extensions
},
module: {
rules: [
jsLoader,
jsxLoader,
cssLoader,
scssLoader,
svgLoader
],
noParse: [ /node_modules\/sinon\// ]
},
// workaround for module resolve issues, see: https://github.com/airbnb/enzyme/issues/302
externals: {
'cheerio': 'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react/addons': true
},
devtool: 'cheap-module-source-map'
};