-
Notifications
You must be signed in to change notification settings - Fork 20
/
karma.conf.js
77 lines (63 loc) · 1.66 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
/**
* Run karma start --no-coverage to get non instrumented code to show up in the dev tools
*/
var webpackConfig = require('./webpack.config')
function config (c) {
return {
frameworks: ['mocha', 'effroi'],
preprocessors: {
'tests/index.js': ['webpack', 'sourcemap']
},
files: [
'tests/index.js'
],
reporters: c.coverage ? ['progress', 'coverage'] : ['progress'],
// this watcher watches when bundled files are updated
autoWatch: true,
webpack: Object.assign(webpackConfig, {
entry: undefined,
// this watcher watches when source files are updated
watch: true,
devtool: 'inline-source-map',
module: Object.assign(webpackConfig.module, {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015'],
plugins: ['transform-runtime', 'transform-async-to-generator']
}
}],
postLoaders: c.coverage ? [{
test: /\.js/,
exclude: /(test|node_modules)/,
loader: 'istanbul-instrumenter'
}] : []
})
}),
webpackServer: {
noInfo: true
},
client: {
useIframe: true,
captureConsole: true,
mocha: {
ui: 'qunit'
}
},
browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],
browserNoActivityTimeout: 30000,
coverageReporter: c.coverage ? {
reporters: [
{type: 'html', dir: 'coverage/'},
{type: 'text-summary'}
]
} : {}
}
}
module.exports = function (c) {
c.coverage = c.coverage !== false
c.set(config(c))
}
module.exports.config = config