-
Notifications
You must be signed in to change notification settings - Fork 9
/
karma.config.js
104 lines (94 loc) · 2.67 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
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
/**
* This is the Karma configuration file. It contains information about this skeleton
* that provides the test runner with instructions on how to run the tests and
* generate the code coverage report.
*
* For more info, see: http://karma-runner.github.io/0.12/config/configuration-file.html
*/
module.exports = function(config) {
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 run the tests using the PhantomJS headless browser.
* This is especially useful for continuous integration.
*/
browsers: ['PhantomJS'],
/**
* Use Mocha as the test framework, Sinon for mocking, and
* Chai for assertions.
*/
frameworks: ['mocha', 'sinon-chai'],
/**
* After running the tests, return the results and generate a
* code coverage report.
*/
reporters: ['mocha', 'coverage'],
/**
* When generating a code coverage report, use `lcov` format and
* place the result in coverage/lcov.info
*
* This file will be sent to Coveralls by the `coveralls` npm script.
*/
coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'lcovonly', subdir: '.', file: 'lcov.info' },
{ type: 'html', subdir: 'html' }
]
},
/**
* The configuration for the karma-webpack plugin.
*
* This is very similar to the main webpack.local.config.js, with the
* exception of specifying an istanbul-transformer post loader so
* that we can generate an accurate code coverage report.
*/
webpack: {
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: ['webpack-espower', 'babel'] },
],
postLoaders: [{
test: /\.jsx?$/,
exclude: /(test|node_modules)\//,
loader: 'istanbul-instrumenter'
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
}
},
/**
* 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,
/**
* List of plugins
*/
plugins: [
'karma-*'
],
});
}