@@ -69,6 +69,27 @@ module.exports = function makeWebpackConfig () {
6969 config . devtool = 'eval-source-map' ;
7070 }
7171
72+ /**
73+ * Babel query options
74+ * Reference: https://github.com/babel/babel-loader#options
75+ * https://github.com/istanbuljs/babel-plugin-istanbul
76+ * Instrument JS files with babel-plugin-istanbul for subsequent code coverage reporting
77+ * Skips files that end with .spec.js
78+ */
79+ var babelQueryOptions = null ;
80+ if ( isTest ) {
81+ babelQueryOptions = {
82+ plugins : [
83+ [
84+ 'istanbul' ,
85+ {
86+ exclude : [ '**/*.spec.js' ]
87+ }
88+ ]
89+ ]
90+ }
91+ }
92+
7293 /**
7394 * Loaders
7495 * Reference: http://webpack.github.io/docs/configuration.html#module-loaders
@@ -86,7 +107,8 @@ module.exports = function makeWebpackConfig () {
86107 // Compiles ES6 and ES7 into ES5 code
87108 test : / \. j s $ / ,
88109 loader : 'babel' ,
89- exclude : / n o d e _ m o d u l e s /
110+ exclude : / n o d e _ m o d u l e s / ,
111+ query : babelQueryOptions
90112 } , {
91113 // CSS LOADER
92114 // Reference: https://github.com/webpack/css-loader
@@ -119,21 +141,6 @@ module.exports = function makeWebpackConfig () {
119141 } ]
120142 } ;
121143
122- // ISPARTA LOADER
123- // Reference: https://github.com/ColCh/isparta-instrumenter-loader
124- // Instrument JS files with Isparta for subsequent code coverage reporting
125- // Skips node_modules and files that end with .test.js
126- if ( isTest ) {
127- config . module . preLoaders . push ( {
128- test : / \. j s $ / ,
129- exclude : [
130- / n o d e _ m o d u l e s / ,
131- / \. s p e c \. j s $ /
132- ] ,
133- loader : 'isparta-loader'
134- } )
135- }
136-
137144 /**
138145 * PostCSS
139146 * Reference: https://github.com/postcss/autoprefixer-core
0 commit comments