make coverage generation optional

This commit is contained in:
Joe Fleming 2015-08-24 17:10:00 -07:00
parent 9e1488ebbb
commit d6f4a1f829
2 changed files with 16 additions and 7 deletions

View file

@ -6,10 +6,17 @@ module.exports = (kibana) => {
let findSourceFiles = utils('findSourceFiles');
return new kibana.Plugin({
config: (Joi) => {
return Joi.object({
enabled: Joi.boolean().default(true),
instrument: Joi.boolean().default(false)
}).default();
},
uiExports: {
bundle: async (UiBundle, env, apps) => {
let modules = [];
let config = kibana.config;
// add the modules from all of the apps
for (let app of apps) {
@ -23,11 +30,13 @@ module.exports = (kibana) => {
for (let f of testFiles) modules.push(f);
env.addPostLoader({
test: /\.jsx?$/,
exclude: /[\/\\](__tests__|node_modules|bower_components|webpackShims)[\/\\]/,
loader: 'istanbul-instrumenter'
});
if (config.get('testsBundle.instrument')) {
env.addPostLoader({
test: /\.jsx?$/,
exclude: /[\/\\](__tests__|node_modules|bower_components|webpackShims)[\/\\]/,
loader: 'istanbul-instrumenter'
});
}
return new UiBundle({
id: 'tests',

View file

@ -1,4 +1,4 @@
{
"name": "tests_bundle",
"name": "testsBundle",
"version": "0.0.0"
}