Skip to main content

hitspec validate

Validate .http and .hitspec files for syntax errors without executing them.
hitspec validate <file|directory>

Arguments

ArgumentDescription
<file>Single .http or .hitspec file to validate
<directory>Directory to search recursively for test files

Behavior

The validate command parses each file and reports:
  • Syntax errors (malformed requests, invalid headers)
  • Invalid assertion syntax
  • Undefined variables
  • Circular dependencies
If all files are valid, each is printed with a Valid: prefix. If any file has errors, the command prints the error and exits with a non-zero status.

Examples

hitspec validate tests/api.http

Sample Output

Valid: tests/auth.http
Valid: tests/users.http
Error in tests/broken.http: line 15: unexpected token ">>>"

Use in CI/CD

# Validate before running tests
hitspec validate tests/ && hitspec run tests/ --env staging
# GitHub Actions
- name: Validate test files
  run: hitspec validate tests/

hitspec list

List all requests defined in .http and .hitspec files.
hitspec list <file|directory>

Arguments

ArgumentDescription
<file>Single .http or .hitspec file
<directory>Directory to search recursively for test files

Behavior

The list command parses each file and prints each request with its name and tags. If a request has no @name annotation, the method and URL are used as the display name.

Examples

hitspec list tests/api.http

Sample Output

tests/api.http:
  - healthCheck
    tags: [smoke]
  - login
    tags: [auth]
  - getProfile
    tags: [users]
  - updateProfile
    tags: [users]

Use Cases

  • Discover available tests in a project
  • Verify request names before filtering with --name
  • Audit tag coverage across test files
  • Quick inventory of API endpoints under test