Ahmad-Tayh2 /
testgen-cli
AI-powered test generation CLI for PHP, JavaScript, and TypeScript
Loading repository data…
louayhouimli / repository
AI-powered CLI test generator that creates comprehensive test suites for your JavaScript/TypeScript projects in seconds.
AI-powered CLI test generator that creates comprehensive test suites for your JavaScript/TypeScript projects in seconds.
Generate high-quality, maintainable test files using advanced AI models. TestGenie analyzes your code structure, detects patterns, and creates thorough test coverage automatically.
npm install -g testgenie-ai
# or
yarn global add testgenie-ai
# or
pnpm add -g testgenie-ai
# or
bun add -g testgenie-ai
testgenie init
This interactive setup will configure:
# Generate tests for a specific file
testgenie gen src/utils/helper.ts
# Generate tests for git changes
testgenie gen --diff
# Generate tests for changes since specific commit
testgenie gen --since HEAD~3
# Run all tests with automatic setup
testgenie test
# Run tests with coverage report
testgenie test --coverage
# Watch mode for development
testgenie test --watch
testgenie --help
Get comprehensive help for all available commands and options.
# 1. Initialize project
testgenie init
# 2. Scan for files needing tests
testgenie scan
# 3. Generate tests for specific files
testgenie gen src/components/Button.tsx
# 4. Auto-generate tests for uncovered files
testgenie audit --fix
# 5. Run tests with automatic setup
testgenie test --coverage
# 6. Continuous development with watch mode
testgenie test --watch
testgenie initInitialize or update configuration file.
Options:
--force, -f: Overwrite existing configurationExample:
testgenie init --force
testgenie gen [file]Generate comprehensive test files.
Arguments:
file: Specific file to generate tests forOptions:
--diff, -d: Generate tests for uncommitted git changes--since, -s <commit>: Generate tests for changes since commit--style <style>: Override test style (bdd, tdd, minimal, verbose)--output, -o <dir>: Override output directoryExamples:
# Generate tests for specific file
testgenie gen src/components/Button.tsx
# Generate tests for all changed files
testgenie gen --diff
# Generate tests since last commit
testgenie gen --since HEAD~1
# Use specific style
testgenie gen src/utils/math.js --style minimal
testgenie scan [path]Analyze project for test coverage and discover files.
Arguments:
path: Directory to scan (default: current directory)Options:
--output, -o <file>: Save results to file--format, -f <format>: Output format (json, csv, text)Examples:
# Scan current directory
testgenie scan
# Scan specific directory with JSON output
testgenie scan src --format json --output coverage-report.json
# Quick scan of components
testgenie scan src/components
testgenie audit [path]Comprehensive test coverage audit with recommendations.
Arguments:
path: Directory to audit (default: current directory)Options:
--fix: Auto-generate tests for uncovered files--format, -f <format>: Report format (text, json, html)--deep: Enable deep analysis (file modification times, dependencies)Examples:
# Basic audit
testgenie audit
# Auto-fix missing tests
testgenie audit --fix
# Deep analysis with JSON report
testgenie audit --deep --format json
testgenie test [pattern]Execute tests in the configured test directory with automatic setup.
Arguments:
pattern: Test file pattern to run (optional)Options:
--watch, -w: Watch mode for continuous testing--coverage, -c: Generate coverage reports--reporter, -r <format>: Test reporter format (default, json, verbose, minimal)--filter, -f <pattern>: Filter tests by name pattern--parallel, -p: Run tests in parallel (default: true)--bail, -b: Stop on first test failure--silent, -s: Suppress test output (show only results)--timeout, -t <ms>: Test timeout in milliseconds (default: 30000)Examples:
# Run all tests with automatic setup
testgenie test
# Run tests with coverage
testgenie test --coverage
# Run specific test pattern
testgenie test --filter="Calculator"
# Watch mode with verbose output
testgenie test --watch --reporter=verbose
# Run tests in a specific directory
testgenie test src/components
# Minimal output for CI/CD
testgenie test --silent --reporter=minimal
Features:
testgenie configDisplay current configuration.
Example:
testgenie config
TestGenie provides full Jest integration with automatic setup:
Test Generation:
Automatic Setup:
Test Execution:
testgenie testComing Soon:
Choose from multiple test generation styles:
describe("Calculator", () => {
describe("when adding numbers", () => {
it("should return correct sum for positive numbers", () => {
// test implementation
});
});
});
suite("Calculator", () => {
test("adds positive numbers correctly", () => {
// test implementation
});
});
test("Calculator.add()", () => {
// concise test implementation
});
describe("Calculator utility class", () => {
it("should correctly calculate the sum of two positive integers and return the expected result", () => {
// detailed test implementation with extensive comments
});
});
# Set during init or manually
testgenie init
# Select "TestGenie API"
OPENAI_API_KEY environment variableexport OPENAI_API_KEY="your-api-key"
GOOGLE_GENERATIVE_AI_API_KEY environment variableexport GOOGLE_GENERATIVE_AI_API_KEY="your-api-key"
ANTHROPIC_API_KEY environment variableexport ANTHROPIC_API_KEY="your-api-key"
TestGenie uses testgenie.config.js in your project root:
export default {
// Test framework (Jest only for now)
framework: "jest",
// Test generation style
style: "bdd", // "bdd" | "tdd" | "minimal" | "verbose"
// Test directory
testDir: "__tests__",
// AI provider configuration
ai: {
provider: "testgenie-api", // "testgenie-api" | "openai" | "gemini" | "claude"
model: "auto", // or specific model name
},
// File patterns to include
include: ["src/**/*.{js,ts,jsx,tsx}", "lib/**/*.{js,ts,jsx,tsx}"],
// File patterns to exclude
exclude: [
"**/*.test.{js,ts,jsx,tsx}",
"**/*.spec.{js,ts,jsx,tsx}",
"**/node_modules/**",
],
// Coverage settings
coverage: {
threshold: 80, // minimum coverage percentage
includeUntested: true,
},
// Git integration
git: {
autoCommit: false,
commitMessage: "test: add generated tests",
},
// Output preferences
output: {
emojis: true,
verbose: false,
},
};
| Requirement | Version | Notes |
|---|---|---|
| Node.js | 16+ | LTS recommended |
| Package Manager | npm, yarn, pnpm, or bun | Any modern package manager |
| Git | Any | Optional, for diff-based generation |
| Test Framework | Jest | Mocha/Vitest coming soon |
TestGenie automatically detects and installs missing dependencies when you run testgenie test:
For JavaScript projects:
jest, @jest/globals@testing-library/react, @testing-library/jest-dom (for React)jest-environment-jsdom (for React components)For TypeScript projects:
@types/jest, ts-jest (additional to above)Manual installation (optional):
# JavaScript
npm install --save-dev jest @jest/globals
# TypeScript
npm install --save-dev jest @jest/globals @types/jest ts-jest
# React projects (auto-d
Selected from shared topics, language and repository description—not editorial ratings.
Ahmad-Tayh2 /
AI-powered test generation CLI for PHP, JavaScript, and TypeScript
Ahmad-Tayh /
AI-powered test generation CLI for PHP, JavaScript, and TypeScript
seyseyseyz /
AI-powered test generator for JavaScript/TypeScript projects
leandrojo /
AI-powered test-driven code evolution CLI for TypeScript/JavaScript projects