hitspec supports five output formats, each designed for a different use case. Set the format with the --output (or -o) flag:
To write the output to a file instead of stdout:
Console (default)
Human-readable output with colors, designed for local development. This is the default when no --output flag is specified.
When to use: Local development, debugging, interactive use. The colored output makes it easy to spot failures at a glance.
Flags that affect console output:
JSON
Machine-readable JSON output for scripting, custom dashboards, and programmatic analysis.
When to use: Scripting and automation. Pipe the output to jq for filtering, feed it into monitoring dashboards, or use hitspec diff to compare two JSON result files for regression detection.
Examples:
JUnit XML
Standard JUnit XML format understood by virtually all CI/CD systems. This is the recommended format for CI pipelines.
When to use: CI/CD pipelines. JUnit XML is the de facto standard for test reporting in GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure DevOps, and other CI systems. Use --output-file to write to a file that your CI system can pick up as a test artifact.
CI integration example:
Grant the workflow or job token checks: write when publishing check runs.
TAP (Test Anything Protocol)
TAP is a text-based protocol for reporting test results. It works well with Unix tools and TAP consumers.
When to use: Unix pipelines and environments that already consume TAP output. TAP is a simple line-based format that works naturally with grep, awk, and other text-processing tools. It is also understood by TAP reporters in Node.js, Perl, and other ecosystems.
Examples:
HTML
Generate a self-contained HTML report for sharing test results with stakeholders who may not have terminal access.
The HTML report includes:
- Summary of passed, failed, and skipped tests
- Duration for each request
- Detailed assertion failure messages
- Filterable and sortable results table
When to use: Sharing results with non-technical stakeholders, archiving test runs as artifacts, or generating reports for review meetings. Combine with actions/upload-artifact in CI to attach the report to each build.
From hitspec.yaml
Set reporters and outputDir in hitspec.yaml to choose the reports without flags. This prints the console report and writes a JUnit file for CI:
Each reporter other than console writes a fixed file name in outputDir: hitspec-results.json, hitspec-junit.xml, hitspec-results.tap or hitspec-report.html. Without outputDir, all reporters write to stdout, so only one is allowed (reporters: [json] is the same as --output json). --output, --output-file, HITSPEC_OUTPUT and HITSPEC_OUTPUT_FILE take precedence and ignore both keys. See Configuration for the rules and exit codes.
Use the HITSPEC_OUTPUT environment variable to avoid passing --output on every invocation:
Similarly, HITSPEC_OUTPUT_FILE sets a default output file path:
Last modified on October 19, 2026