DocsConfiguration
Configuration
Configure testgap with a .testgap.toml file in your project root.
Creating a Config File#
Run testgap init to generate a default config file:
testgap initFull Example#
# .testgap.toml
[scan]
include = ["src/**", "lib/**"]
exclude = ["**/generated/**", "**/vendor/**", "**/*.test.*"]
languages = ["rust", "typescript", "python"]
[analysis]
min_severity = "warning" # Only report warning+ gaps
complexity_threshold = 5 # Cyclomatic complexity threshold for "complex"
[ai]
enabled = true
ai_min_severity = "critical" # Only send critical gaps to AI
model = "claude-sonnet-4-20250514"
[output]
format = "human" # human | json | markdown
color = true[scan]#
Controls which files are scanned.
| Option | Type | Default | Description |
|---|---|---|---|
| include | string[] | ["**"] | Glob patterns for files to include |
| exclude | string[] | [] | Glob patterns for files to exclude (e.g. generated code, vendored deps) |
| languages | string[] | all supported | Filter to specific languages: rust, typescript, javascript, python, go |
.gitignore support
testgap automatically respects your
.gitignore rules. Files ignored by git are never scanned. The exclude option is for additional exclusions beyond .gitignore.[analysis]#
Controls gap detection and severity classification.
| Option | Type | Default | Description |
|---|---|---|---|
| min_severity | string | "info" | Minimum severity to report: critical, warning, or info |
| complexity_threshold | number | 5 | Cyclomatic complexity threshold above which a function is considered 'complex' (affects critical classification) |
[ai]#
Controls AI-powered analysis via Claude API.
| Option | Type | Default | Description |
|---|---|---|---|
| enabled | boolean | true | Enable AI analysis. Set false to always run in --no-ai mode |
| ai_min_severity | string | "critical" | Only send gaps at this severity or above to the AI. Reduces API costs dramatically. |
| model | string | "claude-sonnet-4-20250514" | Claude model to use for analysis |
API Key
AI analysis requires the
ANTHROPIC_API_KEY environment variable. If not set, testgap falls back to static analysis only (same as --no-ai).[output]#
Controls output format and display.
| Option | Type | Default | Description |
|---|---|---|---|
| format | string | "human" | Output format: human, json, or markdown |
| color | boolean | true | Enable colored output (auto-disabled when piping) |
CLI vs Config Precedence#
CLI flags always override config file values. For example, --format json overrides format = "human" in the config file. This lets you set team defaults in .testgap.toml while allowing individual overrides.