From 5adc387763aa444c068158a1c329aeb11426057d Mon Sep 17 00:00:00 2001 From: Lorenzo Pini Date: Tue, 31 Jan 2017 15:50:00 +0100 Subject: [PATCH] Instrument code before babel. Fixes #56 --- karma.conf.single-run.js | 14 +++++++------- package.json | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/karma.conf.single-run.js b/karma.conf.single-run.js index 8d7771e8f4..aa7e1a8acd 100644 --- a/karma.conf.single-run.js +++ b/karma.conf.single-run.js @@ -41,6 +41,13 @@ module.exports = function karmaConfig(config) { webpack: { devtool: 'eval', module: { + preLoaders: [ + { + test: /\.jsx?$/, + exclude: /(__tests__|node_modules|legacy|libs\\Cesium|libs\\html2canvas)\\|(__tests__|node_modules|legacy|libs\/Cesium|libs\/html2canvas)\/|webpack\.js|utils\/(openlayers|leaflet)/, + loader: 'babel-istanbul' + } + ], loaders: [ { test: /\.jsx?$/, exclude: /(ol\.js$|node_modules)/, loader: 'babel-loader', include: path.join(__dirname, "web", "client") }, { test: /\.css$/, loader: 'style!css'}, @@ -48,13 +55,6 @@ module.exports = function karmaConfig(config) { { test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?mimetype=application/font-woff" }, { test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader?name=[name].[ext]" }, { test: /\.(png|jpg|gif|svg)$/, loader: 'url-loader?name=[path][name].[ext]&limit=8192'} // inline base64 URLs for <=8k images, direct URLs for the rest - ], - postLoaders: [ - { - test: /\.jsx?$/, - exclude: /(__tests__|node_modules|legacy|libs\\Cesium|libs\\html2canvas)\\|(__tests__|node_modules|legacy|libs\/Cesium|libs\/html2canvas)\/|webpack\.js|utils\/(openlayers|leaflet)/, - loader: 'istanbul-instrumenter' - } ] }, resolve: { diff --git a/package.json b/package.json index c7d0e88dff..fd14f94d5c 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "devDependencies": { "babel-core": "6.8.0", "babel-eslint": "4.1.8", + "babel-istanbul-loader": "^0.1.0", "babel-loader": "6.2.4", "babel-plugin-add-module-exports": "0.1.4", "babel-plugin-object-assign": "1.2.1",