@reapi/cli-next
v0.0.1
Published
ReAPI CLI tool for running API tests and managing test deployments
Maintainers
Readme
@reapi/cli-next
ReAPI CLI tool for running API tests and managing test deployments.
Installation
npm install -g @reapi/cli-next
# or
yarn global add @reapi/cli-next
# or
pnpm add -g @reapi/cli-nextUsage
Running Tests
# Run tests from a local deployment file
reapi test run ./deployment.json
# Run tests from a remote deployment
reapi test run remote://deployment-id
# Run tests with output directory
reapi test run ./deployment.json --output ./test-results
# Run tests with environment variables
reapi test run remote://deployment-id --env ./env.json
# Run tests with configuration file
reapi test run --config ./reapi.yamlAccess Token Options
You can provide access tokens in several ways (in order of priority):
- Direct CLI token:
reapi test run remote://deployment-id --access-token "your-token"- Config file token (reapi.json/yaml):
{
"accessToken": "your-token"
}- Custom environment variable:
# Set custom environment variable
export MY_TOKEN="your-token"
reapi test run remote://deployment-id --access-token-env MY_TOKEN
# Or in config file
{
"accessTokenEnv": "MY_TOKEN"
}- Default environment variable:
export REAPI_ACCESS_TOKEN="your-token"
reapi test run remote://deployment-idConfiguration File
You can use either JSON or YAML for configuration:
# reapi.yaml
target: ./deployment.json
output: ./test-results
env: ./env.json
report: junit,html
reportPath: ./reports
serverUrl: https://api.example.com
throwOnFailure: true// reapi.json
{
"target": "./deployment.json",
"output": "./test-results",
"env": "./env.json",
"report": "junit,html",
"reportPath": "./reports",
"serverUrl": "https://api.example.com",
"throwOnFailure": true
}Options
--target <path>- Test target: local JSON file or remote://uri-o, --output <path>- Output directory path-a, --access-token <token>- Access token for remote deployments--access-token-env <env-name>- Environment variable name for access token-e, --env <path>- Environment file path (JSON/YAML)-r, --report <types>- Report types (junit,html)--report-path <path>- Directory for report files--server-url <url>- ReAPI server URL-t, --throw-on-failure- Exit with error code on test failure-c, --config <path>- Config file path (JSON/YAML)
Development
# Install dependencies
pnpm install
# Run tests
pnpm test
# Build
pnpm build
# Run in development mode
pnpm devLicense
ISC © PeiSong
