Merge branch 'instrument-in-karma' into 'master'

Move babel config for instanbul to karma config

See merge request !9286
This commit is contained in:
Alfredo Sumaran 2017-02-16 17:28:57 +00:00
commit fdf0741ccc
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 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
module.exports = function(config) {
var progressReporter = process.env.CI ? 'mocha' : 'progress';

View File

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