This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
forked from enzymejs/enzyme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf.js
111 lines (94 loc) · 2.47 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* eslint-disable no-var,prefer-arrow-callback,vars-on-top */
require('babel-register');
var IgnorePlugin = require('webpack').IgnorePlugin;
var REACT013 = require('./src/version').REACT013;
var REACT155 = require('./src/version').REACT155;
function getPlugins() {
var 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
*/
if (!REACT013) {
plugins.push(new IgnorePlugin(/react\/lib\/ExecutionEnvironment/));
plugins.push(new IgnorePlugin(/react\/lib\/ReactContext/));
plugins.push(new IgnorePlugin(/react\/addons/));
}
if (REACT013) {
plugins.push(new IgnorePlugin(/react-dom/));
}
if (REACT013 || REACT155) {
plugins.push(new IgnorePlugin(/react-addons-test-utils/));
}
if (!REACT155) {
plugins.push(new IgnorePlugin(/react-test-renderer/));
plugins.push(new IgnorePlugin(/react-dom\/test-utils/));
plugins.push(new IgnorePlugin(/create-react-class/));
}
return plugins;
}
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/_helpers/index.jsx',
],
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: getPlugins(),
},
webpackServer: {
noInfo: true,
},
});
};