Generate tests for your code with automatic framework detection.
$ARGUMENTS
--type <unit|integration|e2e>: Specify test type--framework <jest|vitest|pytest|etc>: Override detected frameworkDetect Test Framework
Analyze Target Code
Generate Tests
# Check package.json for:
- jest
- vitest
- mocha
- ava
- @testing-library/*
# Check for:
- pytest (pyproject.toml, pytest.ini)
- unittest (default)
- nose2
# JavaScript
cat package.json | jq '.devDependencies | keys[]' | grep -E 'jest|vitest|mocha'
# Python
grep -l "pytest" pyproject.toml setup.py requirements*.txt 2>/dev/null
Read the target file and extract:
# JavaScript conventions
src/utils/helper.ts → src/utils/__tests__/helper.test.ts
→ src/utils/helper.test.ts
→ tests/utils/helper.test.ts
# Python conventions
app/utils/helper.py → tests/test_helper.py
→ app/utils/test_helper.py
→ tests/utils/test_helper.py
Create comprehensive tests including:
import { describe, it, expect, vi } from 'vitest';
import { functionName } from '../path/to/module';
describe('functionName', () => {
it('should handle normal input', () => {
const result = functionName('input');
expect(result).toBe('expected');
});
it('should handle empty input', () => {
expect(() => functionName('')).toThrow();
});
it('should handle null input', () => {
expect(functionName(null)).toBeNull();
});
});
import pytest
from app.module import function_name
class TestFunctionName:
def test_normal_input(self):
result = function_name("input")
assert result == "expected"
def test_empty_input(self):
with pytest.raises(ValueError):
function_name("")
def test_none_input(self):
assert function_name(None) is None
# Generate tests for a file
/test src/utils/auth.ts
# Generate tests for specific function
/test src/utils/auth.ts:validateToken
# Specify test type
/test src/api/users.ts --type integration
# Override framework detection
/test src/helpers.js --framework jest
# Generate test stubs only (no implementation)
/test src/complex.ts --stubs
| Type | Purpose | Generated For |
|---|---|---|
unit |
Test isolated functions | Pure functions, utilities |
integration |
Test component interactions | API routes, services |
e2e |
End-to-end flows | User journeys |
snapshot |
UI snapshot tests | React components |
| Flag | Effect |
|---|---|
--type <type> |
Specify test type |
--framework <fw> |
Override framework detection |
--stubs |
Generate empty test stubs only |
--coverage |
Focus on uncovered code paths |
--verbose |
Explain test reasoning |
Automatically detects and mocks:
Automatically includes tests for:
Matches existing project patterns:
After generating tests:
# Run the new tests
npm test -- --watch <test-file>
pytest <test-file> -v
# Check coverage
npm test -- --coverage
pytest --cov=app
--stubs when you want to write tests yourself