-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.config.js
54 lines (48 loc) · 1.41 KB
/
karma.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
var argv = require('yargs').argv;
var path = require('path');
module.exports = function(config) {
config.set({
browsers: ['PhantomJS'],
singleRun: !argv.watch, // just run once by default
frameworks: ['mocha'],
// npm i karma-spec-reporter --save-dev
// displays tests in a nice readable format
reporters: ['spec'],
// include some polyfills for babel and phantomjs
files: [
'tests.webpack.js'
],
preprocessors: {
// these files we want to be precompiled with webpack
// also run tests throug sourcemap for easier debugging
'tests.webpack.js': ['webpack', 'sourcemap']
},
webpack: {
devtool: 'inline-source-map',
resolve: {
// allow us to import components in tests like:
// import Example from 'components/Example';
root: path.resolve(__dirname, './src'),
// allow us to avoid including extension name
extensions: ['', '.js'],
},
module: {
// run babel loader for our tests
loaders: [
{ test: /\.js?$/, exclude: /(node_modules|bower_components)\//, loader: 'babel' },
],
},
},
webpackMiddleware: {
noInfo: true
},
// tell karma all the plugins we're going to be using
plugins: [
'karma-mocha',
'karma-webpack',
'karma-phantomjs-launcher',
'karma-spec-reporter',
'karma-sourcemap-loader'
]
});
};