Skip to content

Commit

Permalink
Use istanbul to measure karma code coverage
Browse files Browse the repository at this point in the history
Notes:

- browserify-istanbul is used instead of a karma-coverage preprocessor
  because of this bug:
  karma-runner/karma-coverage#16 (comment)
- karma-coverage version pinned to 0.2.6 to workaround this bug:
  karma-runner/karma-coverage#123 (comment)
  • Loading branch information
treyhunner committed Feb 17, 2015
1 parent d07d649 commit c5772fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
coverage
node_modules
server/datasources.local.json
server/model-config.local.json
16 changes: 14 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Karma configuration
// Generated on Sun Jan 18 2015 21:07:20 GMT-0800 (PST)

var istanbul = require('browserify-istanbul');

module.exports = function(config) {
config.set({

Expand Down Expand Up @@ -32,15 +34,25 @@ module.exports = function(config) {

browserify: {
debug: true,
transform: ['brfs'],
transform: ['brfs', istanbul({
ignore: ['**/node_modules/**', '**/spec/**'],
})],
bundleDelay: 1000
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'],
reporters: ['coverage', 'dots'],


coverageReporter: {
reporters: [
{type: 'html'},
{type: 'cobertura'},
],
},


// web server port
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"loopback-explorer": "^1.1.0"
},
"devDependencies": {
"browserify-istanbul": "^0.1.5",
"frisby": "git+https://github.com/vlucas/frisby.git",
"gulp": "^3.8.10",
"gulp-develop-server": "^0.2.5",
Expand All @@ -52,6 +53,7 @@
"karma": "^0.12.31",
"karma-browserify": "^2.0.0",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.2.6",
"karma-jasmine": "^0.3.5",
"strongloop": "^2.10.2"
}
Expand Down

0 comments on commit c5772fe

Please sign in to comment.