@tmh-bis-salesforce/tmh-bis-salesforce-cli-plugin
v0.8.3
Published
A small Salesforce CLI plugin with some utilities for running tests, bumping api versions and other stuff.
Downloads
974
Readme
tmh-bis-salesforce-cli-plugin
A small Salesforce CLI plugin with some utilities for running tests, bumping api versions and other stuff.
This plugin is bundled with the Salesforce CLI. For more information on the CLI, read the getting started guide.
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
Install
INFO: The installation requires a Salesforce CLI version equal or greater than @salesforce/cli/1.68.2.
sf plugins install @tmh-bis-salesforce/[email protected]
When installing the plugin you will be asked, if you want to continue the installation, because it is not digitally signed and the authenticity cannot be verified.
To not be prompted (for example in a CI context) you need to create a file unsignedPluginAllowList.json
in one of the following directories:
- (Linux and macOS)
$HOME/.config/sf
- (Windows) Depending on your Windows configuration, either
C:\Users\username\.config\sf
or%LOCALAPPDATA%\sf
The file should look like this:
["@tmh-bis-salesforce/tmh-bis-salesforce-cli-plugin"]
Alternatively the repository can be used to link the plugin manually. Check out the build topic.
Build
To build the plugin locally, make sure to have yarn installed and run the following commands:
# Clone the repository
git clone [email protected]:mobilityhouse/tmh-bis-salesforce-cli-plugin # ssh
git clone https://github.com/mobilityhouse/tmh-bis-salesforce-cli-plugin.git # https
# Install the dependencies and compile
yarn && yarn build
To use your plugin, run using the local ./bin/dev
or ./bin/dev.cmd
file.
# Run using local run file.
./bin/dev tmh apex run testsuites --help
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
# Link your plugin to the sf cli
sf plugins link .
# To verify
sf plugins
Commands
sf tmh apex run testsuites
Run all testsuites of an org.
USAGE
$ sf tmh apex run testsuites -o <value> [--json] [-f] [-a <value>] [-w <value>] [-d <value>] [-p] [-n <value>]
FLAGS
-a, --api-version=<value> Salesforce API version, for org connection.
-d, --output-dir=<value> Test results directory.
-f, --fail-on-first Fail on first failing testsuite.
-n, --number-of-retries=<value> Number of retries for unexpected testsuite failures.
-o, --target-org=<value> (required) Target org username or alias.
-p, --pass-with-no-testsuites Allows the command to pass when no testsuites are found.
-w, --wait=<value> [default: 10 minutes] Streaming client socket timeout in minutes.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Run all testsuites of an org.
Automatically query and run all testsuites of an org.
Decide wether to fail with the first failing testsuite or always running all of them.
EXAMPLES
Run all testsuites and fail on first failing testsuite:
$ sf tmh apex run testsuites --targetusername [email protected] --failonfirst
Run all testsuites, even if a testsuite fails:
$ sf tmh apex run testsuites --targetusername [email protected]
Run all testsuites, even if a testsuite fails, with the default org:
$ sf tmh apex run testsuites
FLAG DESCRIPTIONS
-a, --api-version=<value> Salesforce API version, for org connection.
Override the api version used for api requests made by this command
-d, --output-dir=<value> Test results directory.
If the test results directory is not set, results are not saved. Results are saved in junit and json.
-f, --fail-on-first Fail on first failing testsuite.
If exists the first failing testsuite will lead to stop the execution of further testsuites. Fail on first failing
testsuite.
-n, --number-of-retries=<value> Number of retries for unexpected testsuite failures.
When a testsuite fails unexpected, the testsuite will be executed again for the number of retries, which is entered.
-o, --target-org=<value> Target org username or alias.
Target org username or alias to connect to an org. Will be used for queries and for running the testsuites.
-p, --pass-with-no-testsuites Allows the command to pass when no testsuites are found.
When the command can not query any testsuites and the flag is present, the command will pass with a warning.
-w, --wait=<value> Streaming client socket timeout in minutes.
Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently.
sf tmh source api set
Set the source files API versions.
USAGE
$ sf tmh source api set [--json] [-a <value>] [-v <value>]
FLAGS
-a, --api-version=<value> Set new API version.
-v, --target-dev-hub=<value> Enter the target dev hub username.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Set the source files API versions.
Upgrade the current project and all metadata to the latest or a specific API version.
EXAMPLES
Set the API version in all files to the orgs default API version.
$ sf tmh source api set
Set the API version in all files to a specific API version.
$ sf tmh source api set -a 56.0
FLAG DESCRIPTIONS
-a, --api-version=<value> Set new API version.
Enter an API version, which should be set in all files.
-v, --target-dev-hub=<value> Enter the target dev hub username.
The target dev hub username will be used to get the API version, if not specified.