Package Exports
- @tortest/tortest
- @tortest/tortest/dist/extension.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tortest/tortest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Tortest - AI-Powered Test Generator
Generate useful test files for JavaScript and TypeScript projects with your preferred AI models.
π What is Tortest?
Tortest helps you quickly create test files for your project. You need a Tortest account and an API key to use the CLI.
- Create an account at tortest.com
- Add your own provider API keys (OpenAI, Anthropic Claude, or Google Gemini)
- Generate a Tortest API key, then use it with the CLI to create tests
β¨ Highlights
- π§ Your AI, your choice: Use OpenAI, Anthropic Claude, or Google Gemini
- π Project-aware: Generates tests that respect your projectβs structure
- π― Flexible organization: Mirror, flat, or alongside test file strategies
- βοΈ Configurable: Set directories, suffixes, and organization preferences
- π Safe key handling: Manage provider keys on tortest.com and use a single Tortest key locally
π¦ Installation
Global Installation (Recommended)
npm install -g @tortest/tortestExecute commands directly:
tortest test
tortest key add
tortest settingsLocal Project Installation
npm install --save-dev @tortest/tortestExecute commands with npx:
npx tortest test
npx tortest key add
npx tortest settingsπββοΈ Quick Start
Create Account + Keys
- Sign up at https://tortest.com
- Add your provider keys (OpenAI, Anthropic, or Google Gemini)
- Create a Tortest API key
Add Your Tortest API Key to the CLI
Global installation:
tortest key addLocal installation:
npx tortest key addGenerate Tests
Global installation:
tortest testLocal installation:
npx tortest test
π‘ Usage Examples
Interactive Mode (Recommended)
# Start interactive flow
tortest testCLI Mode (Non-Interactive)
tortest test \
--api-key YOUR_TORTEST_KEY \
--model gpt-4o \
--framework express \
--libraries jest \
--test-type unit \
--entry-point src/Key Management
tortest key add --name "production" # Add new API key
tortest key list # List all stored keys
tortest key activate production # Switch active key
tortest key delete old-key # Remove unused keysConfiguration
tortest settings # Interactive settings
tortest settings list # View current settings
tortest settings set maxConcurrentCalls 5 # Update specific settingποΈ Configuration Options
| Setting | Default | Description |
|---|---|---|
maxGenerationRetries |
5 |
Maximum retries for failed generations (1-20) |
maxConcurrentCalls |
3 |
Concurrent AI API calls (1-10) |
dependencyAnalysisDepth |
2 |
Code dependency analysis depth (1-10) |
testDirectory |
__tests__ |
Directory for generated test files |
testFileSuffix |
"" |
Custom test file suffix (.spec, .test) |
testFileOrganization |
mirror |
Organization strategy (mirror, flat, alongside) |
Test Organization Strategies
- Mirror structure (default) β Recreates your source tree under the test directory for easy navigation.
src/components/Button.tsx β __tests__/components/Button.test.tsx
src/utils/helpers.ts β __tests__/utils/helpers.test.ts- Flat structure β Puts all test files at the root of the test directory for a compact view.
src/components/Button.tsx β __tests__/Button.test.tsx
src/utils/helpers.ts β __tests__/helpers.test.ts- Alongside structure β Keeps tests next to their source files to co-locate implementation and tests.
src/components/Button.tsx β src/components/Button.test.tsx
src/utils/helpers.ts β src/utils/helpers.test.tsπ§ͺ Supported Technologies
Languages
- JavaScript
- TypeScript
- ... more to come
Testing Frameworks
- Jest
- Vitest
- Mocha
- Jasmine
- @testing-library/react
- @testing-library/react-hooks
- enzyme
- @testing-library/vue
- @vue/test-utils
- @testing-library/angular
- @testing-library/svelte
- @testing-library/jest-dom
- @testing-library/user-event
- jsdom
- supertest
- superagent
- sinon
- ... much more
Project Types
- Vanilla JavaScript/TypeScript
- React
- Angular
- Vue.js
- Svelte
- Express.js
- Koa.js
- NestJS
- Fastify
π οΈ CLI Reference
Core Commands
tortest test <command> # Generate tests (interactive mode)
tortest test [options] # Generate tests (command-line mode)
tortest key <command> # Manage API keys
tortest settings <command> # Configure settings
tortest params list # Show all CLI parametersTest Generation Options
--api-key <key> # Tortest API key (required in non-interactive mode)
--model <model> # AI model to use (must be available to your Tortest account)
--framework <framework> # Project framework
--libraries <libs...> # Testing libraries
--test-type <type> # Test type: unit, integration (integration may be limited)
--entry-point <path> # Project entry point
--skip-readiness # Skip readiness evaluation
--bypass-sha-analysis # Bypass SHA analysis and process all files regardless of changes
--max-retries <number> # Maximum retries
--max-concurrent <number> # Concurrent operations
--dependency-depth <number> # Dependency analysis depth
--test-dir <directory> # Test directory
--test-suffix <suffix> # Test file suffix
--organization <type> # File organization strategyπ― Best Practices
Before Using Tortest
- Keep files small and focused β AI models work best with concise files (ideally under 300-400 lines). Break large files into smaller, single-responsibility modules
- Maintain clean project structure β Use consistent naming conventions and organize code logically into directories
- Update dependencies β Ensure all project dependencies are up to date and compatible
- Configure TypeScript properly β If using TypeScript, ensure proper type definitions and tsconfig.json configuration
- Set up proper .gitignore β Exclude unnecessary files (node_modules, build artifacts, logs) from analysis
- Review entry points β Identify the main entry point(s) of your project for focused test generation
During Test Generation
- Start with unit tests β Begin with unit testing before moving to integration tests for better results
- Use appropriate test libraries β Select testing libraries that match your project's existing setup
- Choose the right organization strategy β Pick mirror, flat, or alongside organization based on your team's preferences
- Enable logging for debugging β Use
tortest settings set createLoggingFolder trueto troubleshoot issues - Monitor API usage β Be mindful of rate limits; reduce concurrent calls if needed
After Test Generation
- Review generated tests β Always review and validate generated test cases before committing
- Run tests to verify β Execute the generated tests to ensure they pass and provide meaningful coverage
- Refactor as needed β Modify generated tests to match your specific testing patterns and requirements
- Add edge cases β Supplement generated tests with additional edge cases specific to your business logic
- Integrate with CI/CD β Add generated tests to your continuous integration pipeline
- Document test patterns β Share successful test generation patterns with your team for consistency
Performance Tips
- Use
--bypass-sha-analysissparingly β Only bypass SHA analysis when you specifically want to regenerate tests for unchanged files - Adjust concurrency settings β Lower
maxConcurrentCallsif experiencing rate limiting or API timeouts - Organize by test complexity β Generate simple unit tests first, then tackle more complex integration scenarios
π Troubleshooting
API Key Issues
tortest key list # Verify stored keys
tortest key add # Add new key
tortest key activate <name> # Switch active keyRate Limiting
tortest settings set maxConcurrentCalls 1 # Reduce concurrencyConfiguration Problems
tortest settings reset # Reset to defaults
tortest settings list # Check current settingsDebug Mode
tortest settings set createLoggingFolder trueLogs are created under tortest/ when enabled.
π Security & Privacy
- You must have a Tortest account to use the CLI.
- On tortest.com, add your own provider keys for the AI services you use (OpenAI, Anthropic Claude, or Google Gemini).
- Generate a Tortest API key and use it locally with the CLI. This lets you access any provider/model you configured on your account.
- Your code is sent securely to the AI provider you selected for test generation. Results are then returned to your CLI.
- You control what is logged locally. Enable/disable logging and clean up logs anytime.
π» System Requirements
- Node.js: 16.0 or higher
- Operating Systems: macOS, Linux, Windows
- Memory: 512MB available RAM
- Storage: ~50MB free space for installation
π License
Copyright (c) 2024 Serge Kabwizi. All rights reserved.
This software is licensed under a proprietary license. See the LICENSE file for details.