From 8dc6af6c6418f51bcae698fd1c128c05af4adc93 Mon Sep 17 00:00:00 2001 From: TristanWright Date: Wed, 15 Jun 2016 11:30:11 -0600 Subject: [PATCH] coverage tests --- package.json | 4 +++- test/karma.redux.js | 16 +++++++++++----- test/webpack.redux.js | 11 +++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0253309d..fb8fa569 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,15 @@ "karma-spec-reporter": "0.0.26", "karma-webpack": "1.7.0", "karma-phantomjs-launcher": "1.0.0", + "karma-coverage": "1.0.0", + "karma-sourcemap-loader": "0.3.7", + "istanbul-instrumenter-loader": "0.2.0", "phantomjs-prebuilt": "2.1.7", "jasmine": "2.4.1", "redux-actions-assertions": "1.1.0", "redux-thunk": "2.1.0", "expect": "1.20.1", "babel-polyfill": "6.9.1", - "paraviewweb": "1.6.0", "simput": "1.2.0", "pvw-visualizer": "1.0.11", diff --git a/test/karma.redux.js b/test/karma.redux.js index d7d28060..456f47b4 100644 --- a/test/karma.redux.js +++ b/test/karma.redux.js @@ -11,20 +11,26 @@ module.exports = function(config) { singleRun: true, frameworks: ['jasmine'], browsers: ['PhantomJS'], - reporters: ['spec'], + reporters: ['spec', 'coverage'], plugins: [ 'karma-jasmine', 'karma-phantomjs-launcher', 'karma-spec-reporter', 'karma-webpack', + 'karma-coverage', + 'karma-sourcemap-loader', ], - preprocessors: { - 'tests.webpack.js': ['webpack'], - }, - webpack: wpConfig, files: [ '../node_modules/babel-polyfill/dist/polyfill.js', 'tests.webpack.js' ], + preprocessors: { + 'tests.webpack.js': ['webpack', 'sourcemap'], + }, + webpack: wpConfig, + coverageReporter: { + type: 'html', + dir: 'coverage/', + } }); }; diff --git a/test/webpack.redux.js b/test/webpack.redux.js index 3a344a78..9033906c 100644 --- a/test/webpack.redux.js +++ b/test/webpack.redux.js @@ -55,8 +55,15 @@ module.exports = { test: /\.js$/, exclude: /node_modules/, loader: 'babel?presets[]=es2015,presets[]=react', - } - ] + }, + ], + postLoaders: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'istanbul-instrumenter', + }, + ], }, resolve: { alias: {