Thank you for your interest in contributing to LLM Test Bench! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- CI/CD Pipeline
- Code Quality Standards
- Testing Requirements
- Pull Request Process
- Commit Message Guidelines
Please be respectful and constructive in all interactions. We're building a welcoming community.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/llm-test-bench.git - Add upstream remote:
git remote add upstream https://github.com/ORIGINAL_OWNER/llm-test-bench.git - Create a branch:
git checkout -b feature/your-feature-name
- Node.js 18+ (we recommend using nvm:
nvm use) - npm 9+
- Git
# Install dependencies
npm install
# Setup git hooks (for automatic linting)
npm run prepare# Start development mode with watch
npm run dev
# Run type checking
npm run typecheck
# Run linter
npm run lint
# Run tests in watch mode
npm run test:watch
# Run all checks (like CI does)
npm run ciOur CI/CD pipeline ensures code quality and consistency. All checks must pass before a PR can be merged.
The CI workflow runs on every push and pull request to main or develop branches:
- Format Check - Verifies code is formatted with Prettier
- Lint - Runs ESLint with zero warnings allowed
- Type Check - Ensures TypeScript compiles without errors
- Tests - Runs unit tests on Node.js 18, 20, and 22
- Coverage - Generates code coverage report
- Build - Verifies the package builds successfully
Before submitting a PR, run all CI checks locally:
# Run all CI checks
npm run ci
# Or run individually:
npm run format:check # Check formatting
npm run lint # Check linting
npm run typecheck # Check types
npm run test # Run tests
npm run build # Build packageThe security workflow runs daily and on pull requests:
- NPM Audit - Checks for known vulnerabilities in dependencies
- CodeQL Analysis - Static analysis for security issues
- License Check - Ensures all dependencies use approved licenses
- Secret Scanning - Detects accidentally committed secrets
- SBOM Generation - Creates Software Bill of Materials
Releases are automated via git tags:
# Create and push a version tag
git tag v1.0.0
git push origin v1.0.0This triggers:
- Full test suite
- Build for multiple platforms
- GitHub release creation
- NPM package publication
- Docker image build (if Dockerfile exists)
- Use strict mode (already configured)
- Avoid
anytype - use proper typing - Export types alongside implementations
- Use ES modules (
import/export)
- Zero warnings policy - All warnings are treated as errors in CI
- Maximum line length: 100 characters
- Use
constoverletwhen possible - Prefer arrow functions
- Use async/await over promises
- Single quotes for strings
- 2 space indentation
- Trailing commas
- Semicolons required
- Line width: 100 characters
Auto-format on save is recommended. Configure your editor:
VS Code (.vscode/settings.json):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}- Phase 1: 80% coverage (lines, functions, branches, statements)
- Phase 5: 90% coverage (target for production)
// Example test structure
import { describe, it, expect, beforeEach } from 'vitest';
describe('MyComponent', () => {
beforeEach(() => {
// Setup
});
it('should do something', () => {
// Arrange
const input = 'test';
// Act
const result = myFunction(input);
// Assert
expect(result).toBe('expected');
});
});-
Unit Tests - Test individual functions/classes
- Location:
src/**/*.test.ts - Run:
npm test
- Location:
-
Integration Tests - Test component interactions
- Location:
tests/integration/**/*.test.ts - Run:
npm run test:integration
- Location:
-
Coverage - Generate coverage reports
- Run:
npm run test:coverage - View: Open
coverage/lcov-report/index.html
- Run:
- ✅ All tests pass:
npm test - ✅ Coverage meets threshold:
npm run test:coverage:check - ✅ No linting errors:
npm run lint - ✅ No type errors:
npm run typecheck - ✅ Code is formatted:
npm run format:check - ✅ Build succeeds:
npm run build
Or run everything at once:
npm run ci- Branch is up to date with main
- All CI checks pass
- Tests added/updated for changes
- Documentation updated
- No breaking changes (or documented)
- Commit messages follow convention
- PR description explains the change
When creating a PR, include:
## Description
Brief description of the change
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How has this been tested?
## Checklist
- [ ] Tests pass locally
- [ ] Code follows style guidelines
- [ ] Documentation updated
- [ ] No new warningsWe follow Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding/updating testschore: Build process, dependencies, etc.ci: CI/CD changes
feat(cli): add new run command
Implement the 'ltb run' command with support for glob patterns
and filtering options.
Closes #123fix(providers): handle rate limit errors
Add retry logic with exponential backoff when OpenAI rate limits
are hit.docs(readme): update installation instructions
Add troubleshooting section for common installation issues.Common scopes:
cli- CLI interfaceconfig- Configuration systemproviders- LLM providersassertions- Assertion enginereporting- Report generationcore- Core functionalitytests- Test infrastructureci- CI/CD pipeline
# Run tests for a specific file
npm test -- src/cli/index.test.ts
# Run tests in watch mode for development
npm run test:watch# Run tests with UI
npm run test:uiPre-commit hooks automatically run:
- ESLint on staged TypeScript files
- Prettier on staged files
To bypass hooks (not recommended):
git commit --no-verify"Module not found" errors:
rm -rf node_modules package-lock.json
npm installType errors after update:
npm run typecheckCoverage threshold failures:
npm run test:coverage
# Check which files need more coverage- 📖 Read the documentation
- 💬 Ask questions in GitHub Discussions
- 🐛 Report bugs in GitHub Issues
By contributing, you agree that your contributions will be licensed under the MIT License.