Commit 770c8d0e authored by Sean Roberts's avatar Sean Roberts

Adding code coverage reporting to Karma tests

parent 8c901651
build/**
**/vendor/**/*.js
**/coverage/**
build/
node_modules/
coverage/
'use strict';
var istanbul = require('browserify-istanbul');
module.exports = function(config) {
config.set({
......@@ -57,10 +59,23 @@ module.exports = function(config) {
extensions: ['.coffee'],
noParse: [require.resolve('./vendor/katex')],
configure: function (bundle) {
bundle
.transform('coffeeify')
.plugin('proxyquire-universal');
bundle.plugin('proxyquire-universal');
},
transform: [
'coffeeify',
istanbul({
ignore: ['**/node_modules/**', '**/katex.js', '**/*.html', '**/*.svg'],
// There is an outstanding but with karma-converage and istanbul
// in regards to doing source mapping and transpiling CoffeeScript
// The least bad work around is to replace the instrumenter with
// isparta and it will handle doing the re mapping for us.
// This issue follows the issue and attempts to fix it:
// https://github.com/karma-runner/karma-coverage/issues/157
instrumenter: require('isparta'),
}),
],
},
mochaReporter: {
......@@ -71,9 +86,16 @@ module.exports = function(config) {
output: 'minimal',
},
coverageReporter: {
type : 'html',
// place this in root of the project
dir : '../../../coverage/',
},
// Use https://www.npmjs.com/package/karma-mocha-reporter
// for more helpful rendering of test failures
reporters: ['mocha'],
reporters: ['mocha', 'coverage'],
// web server port
port: 9876,
......
......@@ -554,6 +554,18 @@
"from": "browserify-des@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz"
},
"browserify-istanbul": {
"version": "2.0.0",
"from": "browserify-istanbul@>=2.0.0 <3.0.0",
"resolved": "http://registry.npmjs.org/browserify-istanbul/-/browserify-istanbul-2.0.0.tgz",
"dependencies": {
"minimatch": {
"version": "3.0.3",
"from": "minimatch@>=3.0.0 <4.0.0",
"resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz"
}
}
},
"browserify-ngannotate": {
"version": "1.0.1",
"from": "browserify-ngannotate@>=1.0.1 <2.0.0",
......@@ -2414,11 +2426,50 @@
"from": "isobject@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.0.0.tgz"
},
"isparta": {
"version": "4.0.0",
"from": "isparta@>=4.0.0 <5.0.0",
"resolved": "http://registry.npmjs.org/isparta/-/isparta-4.0.0.tgz",
"dependencies": {
"esprima": {
"version": "2.7.3",
"from": "esprima@>=2.1.0 <3.0.0",
"resolved": "http://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz"
}
}
},
"isstream": {
"version": "0.1.2",
"from": "isstream@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
},
"istanbul": {
"version": "0.4.5",
"from": "istanbul@latest",
"resolved": "http://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz",
"dependencies": {
"esprima": {
"version": "2.7.3",
"from": "esprima@>=2.7.0 <2.8.0",
"resolved": "http://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz"
},
"handlebars": {
"version": "4.0.5",
"from": "handlebars@>=4.0.1 <5.0.0",
"resolved": "http://registry.npmjs.org/handlebars/-/handlebars-4.0.5.tgz"
},
"source-map": {
"version": "0.4.4",
"from": "source-map@>=0.4.4 <0.5.0",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz"
},
"wordwrap": {
"version": "1.0.0",
"from": "wordwrap@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz"
}
}
},
"jade": {
"version": "0.26.3",
"from": "jade@0.26.3",
......@@ -2580,6 +2631,18 @@
"from": "karma-chai@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/karma-chai/-/karma-chai-0.1.0.tgz"
},
"karma-coverage": {
"version": "1.1.1",
"from": "karma-coverage@>=1.1.1 <2.0.0",
"resolved": "http://registry.npmjs.org/karma-coverage/-/karma-coverage-1.1.1.tgz",
"dependencies": {
"minimatch": {
"version": "3.0.3",
"from": "minimatch@^3.0.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz"
}
}
},
"karma-mocha": {
"version": "1.1.1",
"from": "karma-mocha@latest",
......@@ -4889,4 +4952,4 @@
"resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.3.0.tgz"
}
}
}
\ No newline at end of file
}
......@@ -19,6 +19,7 @@
"autoprefixer": "^6.0.3",
"babelify": "^6.1.3",
"browserify": "^13.0.0",
"browserify-istanbul": "^2.0.0",
"browserify-ngannotate": "^1.0.1",
"browserify-shim": "^3.8.12",
"browserify-versionify": "^1.0.6",
......@@ -52,11 +53,14 @@
"gulp-util": "^3.0.7",
"hammerjs": "^2.0.4",
"inherits": "^2.0.1",
"isparta": "^4.0.0",
"istanbul": "^0.4.5",
"jquery": "1.11.1",
"js-polyfills": "^0.1.16",
"karma": "^1.1.0",
"karma-browserify": "^5.0.5",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.0.4",
"karma-phantomjs-launcher": "^1.0.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment