JSPM

@faizkhairi/loadtest-cli

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q29483F
    • License MIT

    CLI tool to benchmark HTTP endpoints with concurrent requests, latency percentiles, and HTML reports

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@faizkhairi/loadtest-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      loadtest-cli

      A fast CLI tool to benchmark HTTP endpoints with concurrent requests, latency percentiles, and HTML reports.

      Features

      • Configurable concurrency — Set total requests and concurrent connections
      • Latency percentiles — p50, p95, p99, min, max, mean
      • Status code breakdown — 2xx/3xx/4xx/5xx distribution
      • Progress bar — Real-time progress with spinner
      • Multiple output formats — Terminal (default), JSON, HTML report with Chart.js
      • Custom requests — HTTP methods, headers, and JSON body support

      Install

      npm install -g @faizkhairi/loadtest-cli

      Usage

      # Basic — 100 requests, 10 concurrent (defaults)
      loadtest https://api.example.com/users
      
      # Custom concurrency and total
      loadtest https://api.example.com/health -n 500 -c 50
      
      # POST with body
      loadtest https://api.example.com/users -m POST -b '{"name":"test"}' -n 200
      
      # Custom headers
      loadtest https://api.example.com/data -H "Authorization:Bearer token123"
      
      # Save HTML report
      loadtest https://api.example.com/users -n 1000 -c 100 -o report.html
      
      # Save JSON report
      loadtest https://api.example.com/users -o results.json

      Options

      Flag Description Default
      -n, --requests <number> Total requests 100
      -c, --concurrency <number> Concurrent connections 10
      -m, --method <method> HTTP method GET
      -H, --header <header...> Custom headers (key:value)
      -b, --body <body> Request body (JSON)
      -t, --timeout <ms> Request timeout 10000
      -o, --output <file> Output file (.json or .html)

      Output Example

        Loadtest → https://api.example.com/users
        500 requests, 50 concurrent, GET
      
        ✔ Completed 500 requests in 3.24s
      
        ┌──────────────────┬───────────┐
        │ Metric           │ Value     │
        ├──────────────────┼───────────┤
        │ Total Requests   │ 500       │
        │ Successful       │ 498       │
        │ Failed           │ 2         │
        │ Duration         │ 3.24s     │
        │ Requests/sec     │ 154.3     │
        └──────────────────┴───────────┘
      
        Latency Distribution
        ┌──────────────────┬───────────┐
        │ Percentile       │ Latency   │
        ├──────────────────┼───────────┤
        │ Min              │ 12.3ms    │
        │ Mean             │ 45.2ms    │
        │ p50              │ 38.1ms    │
        │ p95              │ 112.4ms   │
        │ p99              │ 234.7ms   │
        │ Max              │ 589.2ms   │
        └──────────────────┴───────────┘

      Project Structure

      loadtest-cli/
      ├── src/
      │   ├── index.ts              # CLI entry (Commander.js)
      │   ├── runner.ts             # Load test orchestrator
      │   ├── worker.ts             # HTTP request worker
      │   ├── stats.ts              # Percentiles, RPS calculator
      │   ├── types.ts              # TypeScript interfaces
      │   └── reporter/
      │       ├── terminal.ts       # Colorized terminal output
      │       ├── json.ts           # JSON output
      │       └── html.ts           # HTML report with Chart.js
      └── tests/
          ├── stats.test.ts         # Percentile & stats tests
          └── reporter.test.ts      # JSON reporter tests

      License

      MIT