Skip to main content

Introduction

testpilot-ai is an AI-powered test generation tool for JavaScript and TypeScript that actually works. It generates tests, runs them, and auto-fixes failures in a loop until they pass.

Why testpilot-ai?

testpilot-aiWriting tests manuallyCopilot suggestions
SpeedEntire test file in secondsHours per fileOne test at a time
CoverageEdge cases + error handlingOften forgottenInconsistent
Framework-awareVitest & Jest nativeManual setupGeneric
Multi-providerOpenAI, Anthropic, Google, OllamaOpenAI only
AST-based analysisUnderstands your code structureContext-window limited

Key Features

  • TypeScript AST analysis — Uses the TypeScript compiler API to parse your code, extracting exported functions, classes, parameters, types, JSDoc, and imports
  • Multi-provider LLM support — Works with OpenAI, Anthropic, Google, and Ollama (local models) via aiclientjs
  • Framework-aware — Generates native Vitest or Jest tests with auto-detection from package.json
  • Streaming output — Real-time LLM output in the terminal
  • Smart configuration — CLI flags, config files, and package.json with sensible defaults
  • Clean CLI — Beautiful terminal output with progress and summaries

Quick Example

npx testpilot src/utils.ts --provider openai

This will:

  1. Analyze src/utils.ts using the TypeScript compiler API
  2. Build a rich prompt with full type information
  3. Send it to the LLM and stream the output
  4. Write a src/utils.test.ts file with comprehensive tests