-
Notifications
You must be signed in to change notification settings - Fork 1
/
karma.conf.js
74 lines (63 loc) · 1.88 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
// Reference: http://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function karmaConfig (config) {
config.set({
frameworks: [
// Reference: https://github.com/karma-runner/karma-mocha
// Set framework to mocha
'mocha'
],
reporters: [
// Reference: https://github.com/mlex/karma-spec-reporter
// Set reporter to print detailed results to console
'spec',
// Reference: https://github.com/karma-runner/karma-coverage
// Output code coverage files
'coverage'
],
files: [
// Reference: https://www.npmjs.com/package/phantomjs-polyfill
// Needed because React.js requires bind and phantomjs does not support it
'node_modules/phantomjs-polyfill/bind-polyfill.js',
// Grab all files in the tests directory that contain _test.
'tests/**/*_test.*'
],
preprocessors: {
// Reference: http://webpack.github.io/docs/testing.html
// Reference: https://github.com/webpack/karma-webpack
// Convert files with webpack and load sourcemaps
'tests/**/*_test.*': ['webpack', 'sourcemap'],
'app/**/*.*': 'coverage'
},
browsers: [
// Run tests using PhantomJS
'PhantomJS'
],
singleRun: true,
// Configure code coverage reporter
coverageReporter: {
reporters: [
// generates ./coverage/lcov.info
{
type: 'lcovonly',
subdir: '.'
},
// generates ./coverage/coverage-final.json
{
type: 'json',
subdir: '.'
},
// generates ./coverage/index.html
{
type: 'html',
subdir: '.'
}
]
},
// Test webpack config
webpack: require('./webpack.config'),
// Hide webpack build information from output
webpackMiddleware: {
noInfo: true
}
});
};