forked from enzymejs/enzyme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
92 lines (79 loc) · 2.18 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
88
89
90
91
92
/* eslint-disable no-var,prefer-arrow-callback,vars-on-top */
require('babel-register');
var IgnorePlugin = require('webpack').IgnorePlugin;
var REACT013 = require('./src/version').REACT013;
module.exports = function karma(config) {
config.set({
basePath: '.',
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-mocha',
'karma-webpack',
'karma-sourcemap-loader',
],
customLaunchers: {
Chrome_travis: {
base: 'Chrome',
flags: ['--no-sandbox'],
},
},
frameworks: ['mocha'],
reporters: ['dots'],
files: [
'test/*.{jsx,js}',
],
exclude: [
'test/_*.{jsx,js}',
],
browsers: [
process.env.TRAVIS ? 'Chrome_travis' : 'Chrome',
'Firefox',
],
preprocessors: {
'test/*.{jsx,js}': ['webpack', 'sourcemap'],
},
webpack: {
devtool: 'inline-source-map',
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
alias: {
// dynamic require calls in sinon confuse webpack so we ignore it
sinon: 'sinon/pkg/sinon',
},
},
module: {
noParse: [
// dynamic require calls in sinon confuse webpack so we ignore it
/node_modules\/sinon\//,
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.json$/,
loader: 'json-loader',
},
],
},
plugins: [
/*
this list of conditional IgnorePlugins mirrors the conditional
requires in src/react-compat.js and exists to avoid error
output from the webpack compilation
*/
!REACT013 && new IgnorePlugin(/react\/lib\/ExecutionEnvironment/),
!REACT013 && new IgnorePlugin(/react\/lib\/ReactContext/),
!REACT013 && new IgnorePlugin(/react\/addons/),
REACT013 && new IgnorePlugin(/react-dom/),
REACT013 && new IgnorePlugin(/react-addons-test-utils/),
].filter(function filterPlugins(plugin) { return plugin !== false; }),
},
webpackServer: {
noInfo: true,
},
});
};