Monito CLI

CI/CD Integration

Run Monito tests in your CI/CD pipeline.

Setup

  1. Generate a token: run monito-cli auth token locally and copy the output
  2. Add MONITO_TOKEN as a secret in your CI environment
  3. Install the CLI and run your tests

GitHub Actions

name: Monito Tests
on: [push]
 
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: 20
 
      - name: Install Monito CLI
        run: npm install -g @monito/cli
 
      - name: Run tests
        env:
          MONITO_TOKEN: ${{ secrets.MONITO_TOKEN }}
        run: monito-cli project run <project-id> --json

The project run command exits with code 1 if any test fails, which fails the CI step.

GitLab CI

monito-tests:
  image: node:20
  script:
    - npm install -g @monito/cli
    - monito-cli project run <project-id> --json
  variables:
    MONITO_TOKEN: $MONITO_TOKEN

Exit Codes

CodeMeaningCI Result
0All tests passedPass
1One or more tests failedFail
2CLI error (auth failure, bad input)Fail

Running Without Wait

If you want to trigger tests but not block the pipeline:

monito-cli project run <project-id> --no-wait --json

This triggers the runs and exits immediately with the run IDs.

Running Individual Scenarios

monito-cli scenario run <scenario-id> --json

This is useful for running specific tests in different pipeline stages.

On this page