Move babel config for instanbul to karma config (!9286)

This commit is contained in:
winniehell 2017-02-15 23:39:45 +01:00
parent 5ad1d40c7f
commit 038ed9ad46
3 changed files with 15 additions and 1 deletions

View file

@ -0,0 +1,4 @@
---
title: Move babel config for instanbul to karma config
merge_request: 9286
author: winniehell

View file

@ -2,6 +2,17 @@ var path = require('path');
var webpackConfig = require('./webpack.config.js'); var webpackConfig = require('./webpack.config.js');
var ROOT_PATH = path.resolve(__dirname, '..'); var ROOT_PATH = path.resolve(__dirname, '..');
// add coverage instrumentation to babel config
if (webpackConfig && webpackConfig.module && webpackConfig.module.rules) {
var babelConfig = webpackConfig.module.rules.find(function (rule) {
return rule.loader === 'babel-loader';
});
babelConfig.options = babelConfig.options || {};
babelConfig.options.plugins = babelConfig.options.plugins || [];
babelConfig.options.plugins.push('istanbul');
}
// Karma configuration // Karma configuration
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({

View file

@ -54,7 +54,6 @@ var config = {
exclude: /(node_modules|vendor\/assets)/, exclude: /(node_modules|vendor\/assets)/,
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
plugins: IS_PRODUCTION ? [] : ['istanbul'],
presets: [ presets: [
["es2015", {"modules": false}], ["es2015", {"modules": false}],
'stage-2' 'stage-2'