-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.js
73 lines (72 loc) · 2.62 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
var webpack = require('webpack');
var path = require('path');
module.exports = function (config) {
config.set({
browsers: [ 'PhantomJS' ], //run in PhantomJS
singleRun: true, //just run once by default
frameworks: [ 'mocha' ], //use the mocha test framework
files: [
'tests.webpack.js' //just load this file
],
plugins: [ 'karma-phantomjs-launcher', 'karma-chai', 'karma-mocha',
/*'karma-sourcemap-loader',*/ 'karma-webpack', 'karma-coverage',
'karma-mocha-reporter'
],
preprocessors: {
'tests.webpack.js': [ 'webpack' ] //preprocess with webpack and our sourcemap loader
},
reporters: [ 'mocha', 'coverage' ], //report results in this format
webpack: { //kind of a copy of your webpack config
// devtool: 'sourcemap', //just do inline source maps instead of the default
module: {
preLoaders: [
{
test: /\.js$/,
exclude: [
path.resolve('./node_modules/'),
// path.resolve('src/lib')
],
loader: 'babel'
},
{
test: /\.js$/,
include: path.resolve('./src/lib'),
loader: 'isparta'
},
{
test: /\.less/,
include: path.resolve('./src/lib/styles'),
loader: 'style!css!less'
}
],
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}]/*,
postLoaders: [{ //delays coverage til after tests are run, fixing transpiled source coverage error
test: /src\/.*\.js$/,
exclude: /(test|node_modules|bower_components)\//,
loader: 'istanbul-instrumenter'
}]*/
}
},
webpackServer: {
noInfo: true //please don't spam the console when running in karma!
},
coverageReporter: {
dir: 'coverage',
reporters: [
{
type: 'cobertura',
subdir: '.',
file: 'cobertura.txt'
},
{
type: 'html',
subdir: 'report-html'
}
]
}
});
};