npm package: @sfdx-plugins-lab/plugin-apex-coverage
Description: A Salesforce CLI plugin to work with apex code coverage obtained by `sfdx force:apex:test:run -r human --codecoverage --outputdir <path>`.
Author: Thomas Dvornik
Latest version: 0.1.5

# apex-coverage

A Salesforce CLI plugin to work with apex code coverage obtained by `sfdx force:apex:test:run -r human --codecoverage --outputdir <path>`.

<!-- toc -->
* [apex-coverage](#apex-coverage)
<!-- tocstop -->

## To install

```sh-session
$ sfdx plugins:install apex-coverage
$ sfdx force:apex:test:coverage -h
...
```

For CI/CD, add the plugin to the [unsignedPluginWhiteList.json](https://developer.salesforce.com/blogs/2017/10/salesforce-dx-cli-plugin-update.html) file.

`echo '["@salesforce/plugin-apex-coverage"]' > ~.config/sfdx/unsignedPluginWhiteList.json`

**Note:** This will override an existing unsignedPluginWhiteList.json file.

<!-- commands -->
* [`sfdx force:apex:test:coverage:format -c <filepath> [-f <array>] [-o <directory>] [--apexsourcedir <directory>] [-t <number>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceapextestcoverageformat--c-filepath--f-array--o-directory---apexsourcedir-directory--t-number---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)

## `sfdx force:apex:test:coverage:format -c <filepath> [-f <array>] [-o <directory>] [--apexsourcedir <directory>] [-t <number>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

converts apex code coverage to a different coverage format

```
USAGE
  $ sfdx force:apex:test:coverage:format -c <filepath> [-f <array>] [-o <directory>] [--apexsourcedir <directory>] [-t 
  <number>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -c, --coverage=coverage                                                           (required) filepath to the apex json
                                                                                    coverage file produced by
                                                                                    force:apex:test:run

  -f, --coverageformats=coverageformats                                             [default: clover] an array of new
                                                                                    coverage formats
                                                                                    [clover,json,json-summary,lcov,lcovo
                                                                                    nly,cobertura,html]

  -o, --outputdir=outputdir                                                         [default: (current directory)]
                                                                                    directory to store the new results
                                                                                    folder

  -t, --threshold=threshold                                                         [default: 0.75] the code coverage
                                                                                    threshold

  --apexsourcedir=apexsourcedir                                                     [default: (current directory)] the
                                                                                    apex source directory (all inner
                                                                                    folders will be searched)

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

EXAMPLE
  $ sfdx force:apex:test:run -w 10 -c -r human -d test-reports
  ...
  $ sfdx force:apex:test:coverage:format -c test-reports/test-result-codecoverage.json
  Wrote results to <path>/clover
```

_See code: [lib/commands/force/apex/test/coverage/format.js](https://github.com/forcedotcom/cli-plugins-lab/tree/master/packages/plugin-apex-coverage/blob/v0.1.5/lib/commands/force/apex/test/coverage/format.js)_
<!-- commandsstop -->