rstk-sfdx-utils
Collection of commands to work with SalesforceDX codebases
$ npm install -g rstk-sfdx-utils$ sfdx COMMANDrunning command...$ sfdx (-v|--version|version)rstk-sfdx-utils/0.0.2 darwin-x64 node-v11.10.1$ sfdx --help [COMMAND]USAGE $ sfdx COMMAND...
sfdx <%= command.id %> -f <string> [-o] [-c] [-x] [-y] [--json] [--loglevel trace|debug|info|warn|error|fatal]
Review the unit test codecoverage report for an org and return an error if the coverage is not sufficient
USAGE
$ sfdx rstk:apex:codecoverage:check -f <string> [-o] [-c] [-x] [-y] [--json] [--loglevel
trace|debug|info|warn|error|fatal]
OPTIONS
-c, --ignoreclasscoverage Include this flag will not fail the command if the individal Apex
classes code coverage is below the amount specified
-f, --testcoveragefile=testcoveragefile (required) Location of test coverage file. Usually, this is the
'test-result-707000000000000.json' where the 707 number is the unit
test run id. Be sure to choose the json file.
-o, --ignoreorgcoverage Include this flag will not fail the command if the org coverage is
below the amount specified
-x, --throwerroroninsufficientorgcoverage If true, the command will throw an error exception if the org code
coverage requirement is not met.
-y, --throwerroroninsufficientclasscoverage If true, the command will throw an error exception if the class code
coverage requirement is not met.
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal) [default: warn] logging level for this command invocation
DESCRIPTION
Set org and individual class coverage thresholds in the sfdx-project.json file. Add some or all of the following
attributes to the "plugins.rstk.coverarageRequirement" section of the project json file.
"plugins": {
"rstk": {
"coverarageRequirement": {
"class": "75",
"org": "45",
"ignoreClassCoverage": false,
"ignoreOrgCoverage": true,
"throwErrorOnInsufficientOrgCoverage": false,
"throwErrorOnInsufficientClassCoverage": false
}
}
}
EXAMPLES
$ sfdx rstk:apex:codecoverage:check --targetusername myOrg@example.com --targetdevhubusername devhub@org.com
--testcoveragefile test-result-707000000000000.json
Reviewing code coverage from file test-result-707000000000000.json
$ sfdx rstk:apex:codecoverage:check --testcoveragefile test-result-707000000000000.json --ignoreorgcoverage
--throwerroroninsufficientclasscoverage --json
Reviewing code coverage from file test-result-707000000000000.json