packages/hoppscotch-cli/README.md
A CLI to run Hoppscotch Test Scripts in CI environments.
hopp test [options] [file]: testing hoppscotch collection.json filehopp [options or commands] arguments
-v, --ver: see the current version of the CLI-h, --help: display help for commandhopp -v / hopp --verhopp -h / hopp --helphopp test [options] <file_path_or_id>-e, --env <file_path_or_id> Accepts path to env.json with contents in below format:
{
"ENV1": "value1",
"ENV2": "value2"
}
You can now access those variables using pw.env.get('<var_name>')
Taking the above example, pw.env.get("ENV1") will return "value1"
-d, --delay <delay_in_ms>--token <access_token>--server <server_url>--reporter-junit [path]--iteration-count <no_of_iterations>--iteration-data <file_path>Accepts the path to a CSV file with contents in the below format:
key1,key2,key3
value1,value2,value3
value4,value5,value6
For every iteration the values will be replaced with the respective keys in the environment. For iteration 1 the value1,value2,value3 will be replaced and for iteration 2 value4,value5,value6 will be replaced and so on.
--legacy-sandboxThe Hoppscotch CLI follows pre-1.0 semantic versioning conventions while in alpha (version < 1.0.0):
0.20.0 → 0.21.0): New features, enhancements, or improvements0.20.0 → 0.20.1): Bug fixes, security patches, and minor improvements0.21.0 → 0.30.0): Major version-like bumps for backwards-incompatible changesOnce the CLI reaches stability and a mature feature set, we will transition to standard semantic versioning starting with
1.0.0.
Before you install Hoppscotch CLI you need to make sure you have the dependencies it requires to run.
node-gyp installed. Find instructions here: https://github.com/nodejs/node-gypsudo apt-get install python g++ build-essential
sudo apk add python3 make g++
sudo yum install gcc72 gcc72-c++
sudo pacman -S make gcc python
sudo dnf install python3 make gcc gcc-c++ zlib-devel brotli-devel openssl-devel libuv-devel
Once the dependencies are installed, install @hoppscotch/cli from npm by running:
npm i -g @hoppscotch/cli
pnpm install# These auto-build via postinstall hooks during 'pnpm install'
# Rebuild manually only when you make changes to these packages:
pnpm --filter @hoppscotch/data run build
pnpm --filter @hoppscotch/js-sandbox run build
cd packages/hoppscotch-clipnpm run buildsudo pnpm link --globalhoppWhen contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
After cloning the repository, execute the following commands:
pnpm install
# Build required workspace dependencies (if needed)
# These auto-build via postinstall hooks during 'pnpm install'
# Rebuild manually only when you make changes to these packages:
pnpm --filter @hoppscotch/data run build
pnpm --filter @hoppscotch/js-sandbox run build
# Then build the CLI
cd packages/hoppscotch-cli && pnpm run build
In order to test locally, you can use two types of package linking:
The 'pnpm exec' way (preferred since it does not hamper your original installation of the CLI):
pnpm link @hoppscotch/cli
// Then to use or test the CLI:
pnpm exec hopp
// After testing, to remove the package linking:
pnpm rm @hoppscotch/cli
The 'global' way (warning: this might override the globally installed CLI, if exists):
sudo pnpm link --global
// Then to use or test the CLI:
hopp
// After testing, to remove the package linking:
sudo pnpm rm --global @hoppscotch/cli
To use the Typescript watch scripts:
pnpm run dev