forked from start-react/sb-admin-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.cross-browser.config.js
112 lines (98 loc) · 2.53 KB
/
karma.cross-browser.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
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
112
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = function(config) {
/**
* Used by sauce labs to launch various browsers
*/
var customLaunchers = {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox'
},
sl_ie: {
base: 'SauceLabs',
browserName: 'internet explorer'
}
}
config.set({
/**
* These are the files required to run the tests.
*
* The `Function.prototype.bind` polyfill is required by PhantomJS
* because it uses an older version of JavaScript.
*/
files: [
'./test/polyfill.js',
'./test/main.js'
],
/**
* The actual tests are preprocessed by the karma-webpack plugin, so that
* their source can be properly transpiled.
*/
preprocessors: {
'./test/main.js': ['webpack']
},
/**
* We want to use the Sauce Lab browsers defined above.
*/
browsers: Object.keys(customLaunchers),
/**
* Use Mocha as the test framework, Sinon for mocking, and
* Chai for assertions.
*/
frameworks: ['mocha', 'sinon-chai'],
/**
* Integrate with the sauce labs reporter.
*/
reporters: ['dots', 'saucelabs'],
/**
* The configuration for the karma-webpack plugin.
*/
webpack: {
plugins: [
new ExtractTextPlugin('style.css', { allChunks: true })
],
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader?stage=0" },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader') }
]
},
resolve: {
extensions: ['', '.js', '.jsx', '.css']
}
},
/**
* Configuration option to turn off verbose logging of webpack compilation.
*/
webpackMiddleware: {
noInfo: true
},
/**
* Once the mocha test suite returns, we want to exit from the test runner as well.
*/
singleRun: true,
/**
* Identifies the sauce labs session name
*/
sauceLabs: {
testName: 'Essential React Unit Tests'
},
/**
* Used by sauce labs to launch the various browsers defined above
*/
customLaunchers: customLaunchers,
/**
* List of plugins
*/
plugins: [
'karma-mocha',
'karma-webpack',
'karma-sinon-chai',
'karma-sauce-launcher'
],
});
}