https://github.com/unframework/karma-coverage
A Karma plugin. Generate code coverage.
https://github.com/unframework/karma-coverage
Last synced: 6 months ago
JSON representation
A Karma plugin. Generate code coverage.
- Host: GitHub
- URL: https://github.com/unframework/karma-coverage
- Owner: unframework
- License: mit
- Fork: true (karma-runner/karma-coverage)
- Created: 2013-10-13T04:05:18.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-10-13T05:04:21.000Z (over 12 years ago)
- Last Synced: 2024-04-14T18:22:16.380Z (almost 2 years ago)
- Language: CoffeeScript
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# karma-coverage [](https://travis-ci.org/karma-runner/karma-coverage)
> Generate code coverage using [Istanbul].
## Installation
The easiest way is to keep `karma-coverage` as a devDependency in your `package.json`.
```json
{
"devDependencies": {
"karma": "~0.10",
"karma-coverage": "~0.1"
}
}
```
You can simple do it by:
```bash
npm install karma-coverage --save-dev
```
## Configuration
Following code shows the default configuration...
```js
// karma.conf.js
module.exports = function(config) {
config.set({
files: [
'src/**/*.js',
'test/**/*.js'
],
// coverage reporter generates the coverage
reporters: ['progress', 'coverage'],
preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'src/*.js': ['coverage']
},
// optionally, configure the reporter
coverageReporter: {
type : 'html',
dir : 'coverage/'
}
});
};
```
### Options
#### type
**Type:** String
**Possible Values:**
* `html` (default)
* `lcov` (lcov and html)
* `lcovonly`
* `text`
* `text-summary`
* `cobertura` (xml format supported by Jenkins)
If you set `type` to `text` or `text-summary`, you may set the `file` option, like this.
```javascript
coverageReporter = {
type : 'text',
dir : 'coverage/',
file : 'coverage.txt'
}
```
If no filename is given, it will write the output to the console.
#### dir
**Type:** String
**Description:** This will be used to output coverage reports. When
you set a relative path, the directory is resolved against the `basePath`.
----
For more information on Karma see the [homepage].
[homepage]: http://karma-runner.github.com
[Istanbul]: https://github.com/yahoo/istanbul