Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var path = require('path'),
var istanbul,
collector,
options = {
dir: 'coverage'
dir: 'coverage',
reporters: ['lcov', 'json']
};

try {
Expand Down Expand Up @@ -38,7 +39,11 @@ exports.report = function() {

if (collector) {
Report = istanbul.Report;
reports = [Report.create('lcov', options), Report.create('json', options)];

reports = options.reporters.map(function (report) {
return Report.create(report, options);
});

reports.forEach(function(rep) {
rep.writeReport(collector, true);
});
Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,10 @@ Some tests examples

### Coverage

Code coverage via Istanbul. To utilize, install `istanbul` and set option `coverage: true` or give a path where to store report `coverage: {dir: "coverage/path"}` or pass `--cov` parameter in the shell. Coverage calculations based on code and tests passed to `node-qunit`.
Code coverage via Istanbul.

To utilize, install `istanbul` and set option `coverage: true` or give a path where to store report `coverage: {dir: "coverage/path"}` or pass `--cov` parameter in the shell.

To specify the format of coverage report pass reporters array to the coverage options: `coverage: {reporters: ['lcov', 'json']}` (default)

Coverage calculations based on code and tests passed to `node-qunit`.