Skip to content

Commit 32a13b4

Browse files
committed
[Update] Added babel-plugin-istanbul to substitute isparta-loader (deprecated).
1 parent 2f64fc9 commit 32a13b4

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
"autoprefixer": "^6.0.3",
2828
"babel-core": "^6.2.1",
2929
"babel-loader": "^6.2.0",
30+
"babel-plugin-istanbul": "^2.0.1",
3031
"babel-preset-es2015": "^6.1.18",
3132
"copy-webpack-plugin": "^3.0.1",
3233
"css-loader": "^0.23.0",
3334
"extract-text-webpack-plugin": "^1.0.1",
3435
"file-loader": "^0.9.0",
3536
"html-webpack-plugin": "^2.7.1",
36-
"isparta-loader": "^2.0.0",
3737
"jasmine-core": "^2.3.4",
3838
"karma": "^1.1.0",
3939
"karma-coverage": "^1.0.0",

webpack.config.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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: /\.js$/,
88109
loader: 'babel',
89-
exclude: /node_modules/
110+
exclude: /node_modules/,
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: /\.js$/,
129-
exclude: [
130-
/node_modules/,
131-
/\.spec\.js$/
132-
],
133-
loader: 'isparta-loader'
134-
})
135-
}
136-
137144
/**
138145
* PostCSS
139146
* Reference: https://github.com/postcss/autoprefixer-core

0 commit comments

Comments
 (0)