JSPM

@tortest/tortest

1.0.24
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q22734F
  • License SEE LICENSE IN LICENSE

AI-powered test generation CLI that automatically creates comprehensive test suites for JavaScript and TypeScript projects using advanced AI models (OpenAI, Anthropic, Google Gemini).

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

Tortest Logo

Generate useful test files for JavaScript and TypeScript projects with your preferred AI models.

npm version Downloads License Node.js Version

Website


πŸš€ 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

npm install -g @tortest/tortest

Execute commands directly:

tortest test
tortest key add
tortest settings

Local Project Installation

npm install --save-dev @tortest/tortest

Execute commands with npx:

npx tortest test
npx tortest key add
npx tortest settings

πŸƒβ€β™‚οΈ Quick Start

  1. Create Account + Keys

    • Sign up at https://tortest.com
    • Add your provider keys (OpenAI, Anthropic, or Google Gemini)
    • Create a Tortest API key
  2. Add Your Tortest API Key to the CLI

    Global installation:

    tortest key add

    Local installation:

    npx tortest key add
  3. Generate Tests

    Global installation:

    tortest test

    Local installation:

    npx tortest test

πŸ’‘ Usage Examples

# Start interactive flow
tortest test

CLI 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 keys

Configuration

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 parameters

Test 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 true to 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-analysis sparingly β€” Only bypass SHA analysis when you specifically want to regenerate tests for unchanged files
  • Adjust concurrency settings β€” Lower maxConcurrentCalls if 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 key

Rate Limiting

tortest settings set maxConcurrentCalls 1  # Reduce concurrency

Configuration Problems

tortest settings reset        # Reset to defaults
tortest settings list         # Check current settings

Debug Mode

tortest settings set createLoggingFolder true

Logs 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.


Ready to generate tests with your favorite AI model?

Get Started

Ship better tests, faster. ✨