Enable coverage reporting.

This patch enables code coverage reporting during unit tests via
the `karma-coverage` plugin, and writes them in HTML form to the
`cover` directory where they can be collected as part of the test
job output.

Change-Id: Ic280664eaf5d5f85acfaeb3f54b314129e9ed786
This commit is contained in:
Tim Buckley 2015-11-13 15:14:59 -07:00
parent 6915cc7bd6
commit 03258a61c2
3 changed files with 21 additions and 2 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
.idea
node_modules
build
cover
app/js/templates.js
*.py[cod]

View File

@ -118,8 +118,18 @@ To test javascript code, run::
npm test
This will execute both unit and end-to-end tests, and will write coverage
reports to :code:`./cover`. To indvidually run unit tests and generate coverage
reports, run::
npm run unit
Similarly, to run only end-to-end tests, run::
npm run e2e
Alternatively, you can start the karma server and have it watch for changes in
your files so that tests are run every time they change, allowing for much
your files so that unit tests are run every time they change, allowing for much
faster feedback::
./node_modules/karma/bin/karma start test/karma.conf.js --no-single-run

View File

@ -23,7 +23,7 @@ module.exports = function(config) {
'app/js/**/*.js': ['browserify', 'babel', 'coverage']
},
reporters: ['spec'],
reporters: ['spec', 'coverage'],
port: 9876,
@ -57,6 +57,14 @@ module.exports = function(config) {
]
},
coverageReporter: {
type: 'html',
dir: 'cover',
instrumenterOptions: {
istanbul: {noCompact: true}
}
},
proxies: {
'/': 'http://localhost:9876/'
},