@@ -26,11 +26,22 @@ module.exports = function (config) {
2626 // preprocess matching files before serving them to the browser
2727 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
2828 preprocessors : {
29- './karma-shim.js' : [ 'webpack' , 'sourcemap' ]
29+ './karma-shim.js' : [ 'coverage' , ' webpack', 'sourcemap' ]
3030 } ,
3131
3232 webpack : webpackConfig ,
3333
34+ coverageReporter : {
35+ type : 'in-memory'
36+ } ,
37+
38+ remapCoverageReporter : {
39+ 'text-summary' : null ,
40+ json : './coverage/coverage.json' ,
41+ html : './coverage/html' ,
42+ lcovonly : './coverage/lcov.info'
43+ } ,
44+
3445 webpackMiddleware : {
3546 // webpack-dev-middleware configuration
3647 // i. e.
@@ -44,7 +55,7 @@ module.exports = function (config) {
4455 // test results reporter to use
4556 // possible values: 'dots', 'progress', 'mocha'
4657 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
47- reporters : [ "mocha" ] ,
58+ reporters : [ "mocha" , "coverage" , "remap-coverage" ] ,
4859
4960 // web server port
5061 port : 9876 ,
@@ -68,20 +79,6 @@ module.exports = function (config) {
6879 singleRun : true
6980 } ;
7081
71- if ( ! isTestWatch ) {
72- _config . reporters . push ( "coverage" ) ;
73-
74- _config . coverageReporter = {
75- dir : 'coverage/' ,
76- reporters : [ {
77- type : 'json' ,
78- dir : 'coverage' ,
79- subdir : 'json' ,
80- file : 'coverage-final.json'
81- } ]
82- } ;
83- }
84-
8582 config . set ( _config ) ;
8683
8784} ;
0 commit comments