forked from neos/neos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.testing.config.js
59 lines (54 loc) · 1.82 KB
/
webpack.testing.config.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
const fs = require('fs');
const defaultConfig = require('./webpack.config');
const babelConfig = JSON.parse(fs.readFileSync('./.babelrc', 'utf8'));
module.exports = Object.assign({}, defaultConfig, {
devtool: 'inline-source-map',
module: {
preLoaders: [
//
// Since the coverage of karma doesn't relate to the ES2015 source files,
// we need to use the isparta loader which will handle the generation of ES2015 coverage metrics.
//
// Since the `.spec.js` should not be included in the coverage metrics, they will be compiled
// traditionally via `babel` instead.
//
// Note: Isparta itself uses babel as well, so all changes in the `.babelrc` will be reflected in
// the test suite as well.
//
{
test: /\.sepc.js$/,
loader: 'babel'
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)\/|\.spec.js$/,
loader: 'isparta'
}
],
loaders: defaultConfig.module.loaders.concat(
//
// Workaround for sinon since it requires itself,
// and webpack can't handle circular dependencies.
//
// @see https://github.com/webpack/webpack/issues/177
//
{
test: /sinon\/pkg\/sinon\.js/,
loader: 'imports?define=>false,require=>false'
},
{
test: /\.json$/,
loader: 'json'
}
)
},
isparta: {
embedSource: true,
noAutoWrap: true,
babel: babelConfig
},
externals: {
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
}
});