theintern / intern

A next-generation code testing stack for JavaScript.
https://theintern.io/
Other
4.36k stars 309 forks source link

Combine the coverage reporters, add to updated reporter config #1136

Open jason0x43 opened 4 years ago

jason0x43 commented 4 years ago

The coverage reporters are all just thin wrappers around Istanbul's coverage reporters. Rather than having a bunch of duplicative wrappers, have a single coverage reporter module that accepts options to determine what type of report is to be generated. If multiple types of coverage report are to be generated, multiple reporter instances can be created.

import createCoverageReporter from 'core/lib/reporters/coverage';

// ...

const htmlCov = createCoverageReporter(this, { type: 'html' });
const cobertura = createCoverageReporter(this, { type: 'cobertura' });

Built-in coverage reporters should be configured through a single top level output property:

{
  "output": {
      // use with default options,
    "htmlcoverage": true,

    // use with report-specific options
    "cobertura": {
      "projectRoot": "../../"
    }
  }
}

See discussion in https://github.com/theintern/intern/issues/1023#issuecomment-582607277.

jason0x43 commented 4 years ago

The config updates are related to #1109.