A Salesforce CLI plugin to work with apex code coverage obtained by `sfdx force:apex:test:run -r human --codecoverage --outputdir <path>`.
Last updated 5 months ago by amphro .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @sfdx-plugins-lab/plugin-apex-coverage 
SYNC missed versions from official npm registry.


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

To install

$ sfdx plugins:install apex-coverage
$ sfdx force:apex:test:coverage -h

For CI/CD, add the plugin to the unsignedPluginWhiteList.json file.

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

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

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

  $ 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]

  -c, --coverage=coverage                                                           (required) filepath to the apex json
                                                                                    coverage file produced by

  -f, --coverageformats=coverageformats                                             [default: clover] an array of new
                                                                                    coverage formats

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

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

  --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

  $ 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

Current Tags

  • 0.1.5                                ...           latest (5 months ago)

2 Versions

  • 0.1.5                                ...           5 months ago
  • 0.1.2                                ...           5 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (9)
Dev Dependencies (15)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |