An open API service indexing awesome lists of open source software.

https://github.com/synidsweet/claude-testing-infrastructure

AI-first testing infrastructure for JavaScript/TypeScript and Python projects
https://github.com/synidsweet/claude-testing-infrastructure

ai-agents developer-tools javascript jest pytest python testing testing-framework typescript

Last synced: 2 months ago
JSON representation

AI-first testing infrastructure for JavaScript/TypeScript and Python projects

Awesome Lists containing this project

README

          

# Claude Testing Infrastructure

A comprehensive, AI-agent-friendly testing infrastructure for JavaScript/TypeScript and Python projects. This decoupled approach implements comprehensive testing in any codebase within minutes, not hours.

## πŸ”’ IMPORTANT: This is Infrastructure

**Clone this repo into your project and use as-is. Do NOT modify files.**

- βœ… Clone into your project directory
- βœ… Pull updates regularly: `git pull origin main`
- βœ… Report bugs via GitHub issues (mention `@claude` for automated assistance)
- ❌ Never modify infrastructure files

## πŸš€ Quick Start for AI Agents

After cloning this repository:

### Decoupled Testing Infrastructure (Zero Project Modification)
```bash
npm install
npm run build

# Analyze any project
node dist/src/cli/index.js analyze /path/to/your/project

# Generate comprehensive tests
node dist/src/cli/index.js test /path/to/your/project

# Run tests with coverage
node dist/src/cli/index.js run /path/to/your/project --coverage
```
This maintains tests externally while providing complete testing infrastructure that updates via `git pull`.

## 🎯 What This Project Does

This infrastructure helps you:
- **Set up comprehensive testing** in under 10 minutes
- **Support both JavaScript/TypeScript and Python** projects automatically
- **Generate test templates** for your specific framework (React, Vue, Express, FastAPI, Django, etc.)
- **Achieve >80% test coverage** with provided templates and patterns
- **Integrate with CI/CD** platforms like GitHub Actions

## πŸ“– For AI Agents: Navigation Guide

1. **First Time?** Read `AI_AGENT_GUIDE.md` for stable, comprehensive project navigation
2. **Architecture Questions?** See `/docs/architecture/overview.md` for design philosophy
3. **Full Documentation Hub?** See `PROJECT_CONTEXT.md` for modular documentation structure
4. **User Guide?** See `/docs/user/getting-started.md` for complete usage examples

## πŸ”§ Installation & Setup

### Prerequisites
- Node.js 14+
- Git
- Target project runtime (Python 3.9+ for Python projects)

### Git Ownership Setup
If you encounter git dubious ownership warnings:
```bash
# Add the infrastructure directory to git safe.directory
git config --global --add safe.directory "$(pwd)"

# Or for the target project if needed
git config --global --add safe.directory "/path/to/your/project"
```

### Installation Options

#### For Testing Your Own Projects (Recommended)
Use the clean deployment branch that contains only the core infrastructure:
```bash
git clone -b deploy/clean https://github.com/SynidSweet/claude-testing-infrastructure.git
cd claude-testing-infrastructure
npm install
npm run build
```

#### For Contributing to the Infrastructure
Use the main branch with full development environment:
```bash
git clone https://github.com/SynidSweet/claude-testing-infrastructure.git
cd claude-testing-infrastructure
npm install
npm run build
```

2. **Analyze Your Project**
```bash
node dist/src/cli/index.js analyze /path/to/your/project
```

3. **Generate Tests**
```bash
node dist/src/cli/index.js test /path/to/your/project
```

4. **Run Tests with Coverage**
```bash
node dist/src/cli/index.js run /path/to/your/project --coverage
```

5. **Watch Mode for Development**
```bash
node dist/src/cli/index.js watch /path/to/your/project
```

## πŸŽ“ Examples

### JavaScript/React Project
```bash
# Template approach
cd ai-testing-template
npm run init
# Select: Frontend > React > JavaScript
# Testing is now set up in your project!

# Decoupled approach
cd decoupled-testing-suite
npm run discover -- --project-path ../my-react-app
npm run init
npm run test
```

### Python/FastAPI Project
```bash
# Template approach
cd ai-testing-template
npm run init
# Select: Backend > FastAPI > Python
# Testing is now set up in your project!

# Decoupled approach
cd decoupled-testing-suite
npm run discover -- --project-path ../my-fastapi-app
npm run init
npm run test
```

## πŸ—οΈ Architecture Overview

This project uses a **Language Adapter Pattern** to support multiple languages:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Template Approach β”‚ β”‚ Decoupled Approach β”‚
β”‚ (Modifies Project) β”‚ β”‚ (Zero Modification) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Adapter Factory β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚JavaScriptβ”‚ β”‚ Python β”‚ β”‚Multi-Lang β”‚
β”‚ Adapter β”‚ β”‚ Adapter β”‚ β”‚ Adapter β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## πŸ“š Key Features

### Automatic Language Detection
- Detects JavaScript/TypeScript projects via package.json
- Detects Python projects via setup.py, pyproject.toml, requirements.txt
- Supports full-stack projects with both languages

### Framework-Specific Support
- **JavaScript**: React, Vue, Angular, Express, Next.js, Nest.js
- **Python**: FastAPI, Django, Flask, Pytest, unittest
- **Testing**: Jest, Vitest, pytest, Playwright, Cypress

### Comprehensive Test Templates
- Unit tests with mocking patterns
- Integration tests for APIs
- Component tests for UI
- End-to-end test setups
- Performance testing templates

### CI/CD Integration
- GitHub Actions workflows
- GitLab CI templates
- Coverage reporting
- Automated test runs

## πŸ€– AI Agent Instructions

When implementing testing for a project:

1. **Analyze the Project**
```bash
# Check project type
ls package.json setup.py pyproject.toml requirements.txt
```

2. **Analyze Project Structure**
```bash
node dist/src/cli/index.js analyze /path/to/your/project
```

3. **Generate and Run Tests**
```bash
node dist/src/cli/index.js test /path/to/your/project
node dist/src/cli/index.js run /path/to/your/project --coverage
```

4. **Customize as Needed**
- Modify test templates for project-specific needs
- Add custom test utilities
- Configure coverage thresholds
- Set up CI/CD pipelines

## πŸ› οΈ Available Commands

### Production CLI Commands
```bash
node dist/src/cli/index.js analyze # Analyze project structure
node dist/src/cli/index.js test # Generate comprehensive tests
node dist/src/cli/index.js run # Run generated tests
node dist/src/cli/index.js watch # Watch mode for development

# Additional options
node dist/src/cli/index.js test --only-structural # Skip AI generation
node dist/src/cli/index.js run --coverage # With coverage report
node dist/src/cli/index.js test --config # Custom configuration
```

## πŸ“‹ Configuration

### Test Configuration Files
- **JavaScript**: `jest.config.js`, `vitest.config.js`, `.eslintrc.test.js`
- **Python**: `pytest.ini`, `setup.cfg`, `.coveragerc`
- **E2E**: `playwright.config.js`, `cypress.config.js`

### Environment Variables
```bash
# .env.test
TEST_ENV=test
DATABASE_URL=sqlite:///test.db
API_BASE_URL=http://localhost:3000
```

## πŸ› Troubleshooting

### Common Issues

1. **"Cannot find project type"**
- Ensure you're in the correct directory
- Check for package.json or Python config files
- Use `--project-path` flag for custom locations

2. **"Tests failing after setup"**
- Run `npm install` or `pip install -r requirements.txt`
- Check Node/Python version compatibility
- Verify all dependencies are installed

3. **"Permission denied errors"**
- Check file permissions
- Run with appropriate user permissions
- Use `--force` flag if necessary

### Debug Mode
```bash
# Run with debug output
DEBUG=* npm run init

# Verbose logging
npm run init -- --verbose
```

## 🀝 Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

### Development Setup
```bash
# Clone the repository
git clone
cd claude-testing

# Install all dependencies
npm install

# Run tests
npm test

# Check code style
npm run lint
```

## πŸ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## πŸ”— Quick Links

- [Documentation Hub](PROJECT_CONTEXT.md)
- [Architecture Overview](/docs/architecture/overview.md)
- [AI Agent Primary Guide](AI_AGENT_GUIDE.md) - **Protected & Stable**
- [AI Agent Legacy Guide](CLAUDE.md) - Working Document
- [User Guide](/docs/user/getting-started.md)
- [API Reference](/docs/api/interfaces.md)

---

*Built with ❀️ for AI agents and developers who value comprehensive testing*\n
## Task & Sprint Management

This project uses a JSON-based Task & Sprint Management System for organized development.

**Team Prefix**: `CTI`

### Quick Commands
```bash
# Check current sprint and tasks
claude-tasks sprint current

# Add new tasks to backlog
claude-tasks backlog add "Feature description"

# Plan new sprint from backlog
claude-tasks sprint plan --interactive
```

### Sprint Discipline
When a sprint is active, work **only** on sprint tasks. This ensures focused development and clear progress tracking.