11const webpack = require ( 'webpack' ) ;
2+ const path = require ( 'path' ) ;
3+
4+ process . traceDeprecation = true ;
5+
6+ let reporters = [ 'progress' , 'coverage-istanbul' ] ;
7+ if ( process . env . COVERALLS_REPO_TOKEN ) {
8+ reporters . push ( 'coveralls' ) ;
9+ }
210
311module . exports = function ( config ) {
412 config . set ( {
@@ -18,7 +26,7 @@ module.exports = function(config) {
1826 'test/**/*.spec.js' : [ 'webpack' , 'sourcemap' ]
1927 } ,
2028
21- reporters : [ 'dots' , 'coverage' ] ,
29+ reporters : reporters ,
2230
2331 port : 9876 ,
2432
@@ -34,6 +42,7 @@ module.exports = function(config) {
3442
3543 webpack : {
3644 mode : 'development' ,
45+
3746 cache : true ,
3847 devtool : 'inline-source-map' ,
3948 module : {
@@ -45,18 +54,18 @@ module.exports = function(config) {
4554 options : {
4655 presets : [ '@babel/preset-env' ]
4756 }
48- }
49- /*
57+ } ,
5058 {
5159 test : / \. j s $ / ,
52- exclude: /(node_modules|test)/,
53- loader: 'istanbul-instrumenter-loader',
5460 enforce : 'post' ,
55- options: {
56- esModules: true
57- }
61+ use : {
62+ loader : 'istanbul-instrumenter-loader' ,
63+ options : {
64+ esModules : true
65+ }
66+ } ,
67+ include : path . resolve ( 'src/' )
5868 }
59- */
6069 ]
6170 } ,
6271 plugins : [
@@ -71,13 +80,12 @@ module.exports = function(config) {
7180 stats : {
7281 colors : true
7382 }
83+ } ,
84+ coverageIstanbulReporter : {
85+ reports : [ 'html' , 'lcov' , 'text-summary' ] ,
86+ dir : path . join ( __dirname , 'coverage' ) ,
87+ combineBrowserReports : true ,
88+ fixWebpackSourcePaths : true
7489 }
75- /*
76- coverageReporter: {
77- type: 'lcov',
78- dir: 'coverage/',
79- subdir: '.'
80- }
81- */
8290 } ) ;
8391} ;
0 commit comments