karma-runner / karma-runner/karma-coverage

Coverage report includes bower components when using browserify

Open
#164 0 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

My angular project uses browserify and debowerify (for including bower components) and I've managed to get code coverage working, but it seems to include all of the bower components along with my own code. Does anyone have any idea what could be causing this?

Here is my karma.conf file:

```
'use strict';

module.exports = function (config) {
config.set({
basePath: './',

frameworks: ['browserify', 'mocha', 'chai', 'sinon'],

files: [
'./libs/angular/angular.js',
'./libs/angular-mocks/angular-mocks.js', // for angular.mock.module and inject.
'./app/**/*.js'
],

exclude: [],

preprocessors: {
'./app/**/!(*spec)*.js': ['browserify']
},

browserify: {
debug: true,
transform: ['debowerify', 'html2js-browserify', 'browserify-istanbul'],
extensions: ['.js']
},

reporters: ['spec', 'coverage'],
coverageReporter: {
type: 'html',
dir: './reports/coverage'
},

port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [
// 'Chrome',
'PhantomJS'
],

singleRun: false
});
};
```

Contributor guide

Open the contributing guide

Research direction

Start with the karma.conf.js settings shown, especially the browserify preprocessor and the debowerify and browserify-istanbul transforms. Reproduce the coverage report and trace why bower components are instrumented. Done means the report includes the project's app code without including bower components.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.