AI-Powered Test Gap Finder

Scans your codebase with tree-sitter, identifies untested functions, and uses Claude to suggest what tests to write.

install
$cargo install testgap
testgap — demo

$ cat features.md

Static analysis, AI insights, CI-ready output

Tree-sitter Parsing

Extracts every function from your codebase using tree-sitter grammars. No runtime needed — works on raw source files.

Severity Classification

Critical: public + complex + untested. Warning: public + untested. Info: private + untested. Prioritize what matters.

AI Risk Assessment

Optionally send gaps to Claude AI for risk analysis and test suggestions. Use --ai-severity to control API costs.

Parallel Parsing

Uses rayon for multi-core file parsing. Respects .gitignore rules automatically. Fast even on large codebases.

CI Integration

JSON output, SARIF format, --fail-on-critical exit codes. Drop into any CI pipeline as a quality gate.

5 Languages

Rust, TypeScript, JavaScript, Python, Go. Detects test functions by language-specific patterns and conventions.

$ testgap --explain-severity

CRITICALpublic + complex + untested
pub fn process_payment(order: &Order) → Result<Receipt>

High complexity public APIs are most likely to contain bugs and most impactful when they fail.

WARNINGpublic + untested
pub fn parse_config(path: &str) → Config

Public functions are part of your API contract. Regressions here break consumers.

INFOprivate + untested
fn normalize_key(key: &str) → String

Private helpers are lower risk — they're only called by tested public functions.

$ testgap --explain-pipeline

01

Scan

Walk the project and classify source vs test files

02

Extract

Parse functions from source files using tree-sitter

03

Map

Match tests to functions by name, file convention, and body

04

Detect

Identify untested functions and classify severity

05

Analyze

Optional: send gaps to Claude AI for risk assessment

$ testgap --list-languages

supported languages
LanguageExtensionsTest Detection
Rust.rs#[test], #[cfg(test)]
TypeScript.ts, .tsxtest(), it(), describe()
JavaScript.js, .jsxtest(), it(), describe()
Python.pytest_ prefix, test dirs
Go.goTest prefix, *testing.T

$ cat quickstart.sh

quickstart.sh
# Install
cargo install testgap

# Run analysis (no AI, no API key needed)
testgap analyze --no-ai

# Run with AI suggestions (needs ANTHROPIC_API_KEY)
export ANTHROPIC_API_KEY="sk-ant-..."
testgap analyze

# Create a config file
testgap init

# CI mode — fail on critical gaps
testgap analyze --format json --fail-on-critical --no-ai