generate-tests
Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.
Imported description, not reviewed yet
This item came from its original repository and was only scanned automatically; no editor has written an Arabic description for it yet. Read its content yourself before you rely on it. This page is not indexed by search engines until it is reviewed.
Download
Install
After downloading, run the command in a terminal. unzip asks before it replaces any file that is there.
For this project
It goes in: .claude/commands/
mkdir -p .claude/commands && unzip ~/Downloads/generate-tests.zip -d .claude/commandsFor your account on the whole machine
It goes in: ~/.claude/commands/
mkdir -p ~/.claude/commands && unzip ~/Downloads/generate-tests.zip -d ~/.claude/commands
Instructions
Generate Tests
Generate comprehensive test suite for: $ARGUMENTS
Current Testing Setup
- Test framework: !
cat package.json 2>/dev/null | grep -E '"jest"|"vitest"|"mocha"|"jasmine"' | head -3 || cat jest.config.* vitest.config.* 2>/dev/null | head -5 || echo "Framework not detected" - Existing tests: !
find . -name "*.test.*" -o -name "*.spec.*" | head -5 - Test coverage: !
npm run test:coverage 2>/dev/null || echo "No coverage script" - Target: if $ARGUMENTS is a file path, read it with @$ARGUMENTS; if it is a component name, search for it with Grep before writing tests
Test Generation Framework
- Analyze the target file/component structure — identify all exported functions, classes, methods, and their signatures
- Strategy — examine existing test patterns in the project; choose unit vs integration scope; identify critical paths and error scenarios
- Mock Design — map all external dependencies (I/O, APIs, timers, dates); create factories for test data; plan cleanup for async operations
- Unit Tests — write isolated tests per function/method covering happy path, edge cases, and error conditions; follow AAA pattern (Arrange, Act, Assert)
- Integration Tests — test component interactions, API layers with mocked responses, and end-to-end user workflows where applicable
- Quality Check — verify naming describes behavior not implementation; confirm 80%+ coverage on critical business logic; ensure test isolation
Framework-Specific Guidance
- React: Component testing with React Testing Library; test user interactions and rendering
- Vue: Component testing with Vue Test Utils; test props, events, and slots
- Angular: Component and service testing with TestBed; test dependency injection
- Node.js: API endpoint and middleware testing; test request/response cycles
- Python:
pytestwith fixtures,unittest.mockfor patching,pytest-covfor coverage - Go: Table-driven tests in
_test.gofiles,testify/assertfor assertions, subtests viat.Run() - Rust:
#[cfg(test)]modules,#[test]attributes,mockallfor mocking
Best Practices
- Follow AAA pattern (Arrange, Act, Assert)
- 80%+ coverage; prioritize critical business logic and error paths
- Mock external I/O; use factories for test data
- Naming: describe what the function does, not implementation details
Files
- LICENSE1 KB
- generate-tests.md2.6 KB
What the automatic scan found
We scanned the files automatically when they were imported. This is what the scan pointed at. It does not mean the item is harmful, and it does not mean it is safe: read it yourself.
- Needs a lookAllowed tools with no limits
In file cli-tool/components/commands/testing/generate-tests.md
Comments (0)
No comments yet. Be the first.
Sign in to comment. Commenting comes at level 1 (Member).