Skip to main content

hitspec init

Initialize a new hitspec project in the current directory.
hitspec init [flags]

What It Creates

FileDescription
hitspec.yamlConfiguration file with default environments (dev, staging, prod)
example.httpExample test file with CRUD operations and captures

Flags

FlagShortDescriptionDefault
--force-fOverwrite existing filesfalse

Examples

# Initialize a new project
hitspec init

# Overwrite existing files
hitspec init --force

Generated Config

The generated hitspec.yaml includes:
defaultEnvironment: dev
timeout: 30s
retries: 0
followRedirects: true
maxRedirects: 10
validateSSL: true
headers:
  User-Agent: hitspec/1.0
environments:
  dev:
    baseUrl: http://localhost:3000
  staging:
    baseUrl: https://staging.api.example.com
  prod:
    baseUrl: https://api.example.com

Generated Example

The generated example.http demonstrates:
  • Variable definitions with @baseUrl
  • Request metadata (@name, @description, @tags)
  • Assertion blocks with >>> / <<<
  • Capture blocks with >>>capture / <<<
  • Dependencies with @depends
Run the example:
hitspec run example.http