Skip to content

Commit

Permalink
Fix: Coverage highlight results
Browse files Browse the repository at this point in the history
Coverage did not show correct results, after doing some research I could
make it work.
This is solved by using browserify-istanbul as commented here:

karma-runner/karma-coverage#16
  • Loading branch information
jotaoncode committed Nov 1, 2015
1 parent c91e51c commit d99a0eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions karma.local.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var istanbul = require('browserify-istanbul');

module.exports = function(config) {
config.set({
//logLevel: 'LOG_DEBUG',
Expand Down Expand Up @@ -31,7 +33,7 @@ module.exports = function(config) {
exclude: [],

preprocessors: {
'src/**/*.js': ['browserify', 'coverage'],
'src/**/*.js': ['browserify'],
'test/**/*.js': ['browserify']

},
Expand Down Expand Up @@ -60,7 +62,15 @@ module.exports = function(config) {
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
'PhantomJS2'//, 'Firefox'
]
],

// using browserify-istanbul as suggested by
// https://github.com/karma-runner/karma-coverage/issues/16
browserify: {
debug: true,
transform: [ 'brfs', istanbul({
ignore: ['**/node_modules/**', '**/test/**']
})]
}
});
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"coveralls": "^2.11.2"
},
"devDependencies": {
"brfs": "^1.4.1",
"browserify-istanbul": "^0.2.1",
"istanbul": "^0.3.15",
"karma": "^0.12.36",
"karma-browserify": "^4.0.0",
Expand Down

0 comments on commit d99a0eb

Please sign in to comment.