npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dheerajsingh5832/smart-testgen

v1.0.0

Published

Generate high-quality LLM prompts for test generation without calling any LLM API

Downloads

53

Readme

smart-testgen

Generate high-quality LLM prompts for test generation without calling any LLM API

Perfect for use with GitHub Copilot, Cursor, ChatGPT, Claude, or any AI assistant.

Features

  • No LLM API calls - generates prompts only, you control the AI
  • IDE-agnostic - works with any AI tool (Copilot, Cursor, ChatGPT, Claude)
  • Multiple frameworks - Jest, Vitest, Mocha
  • Multiple test types - Unit, Integration, E2E
  • TypeScript support - fully typed with strict mode
  • CLI included - easy to use from terminal
  • No vendor lock-in - use any LLM you prefer

Installation

npm install -g smart-testgen

Quick Start

1. Generate a prompt

smart-testgen generate --file src/calculator.ts --framework jest --type unit --ide

2. Copy the output

The tool outputs a formatted prompt:

========================================
PASTE THIS INTO COPILOT OR CURSOR
========================================

You are a senior QA automation engineer.

Generate jest unit tests for the following code.

Rules:
- Cover happy path
- Cover edge cases
- Cover invalid inputs
...
========================================

3. Paste into your AI tool

  • GitHub Copilot Chat (Cmd+Shift+I in VS Code)
  • Cursor
  • ChatGPT
  • Claude
  • Any AI assistant

4. Get complete test code

The AI generates comprehensive tests based on the prompt.

Usage

Command Syntax

smart-testgen generate [options]

Options

| Option | Description | Required | Default | |--------|-------------|----------|---------| | --file <path> | Path to source file | Yes | - | | --framework <name> | Test framework (jest/vitest/mocha) | Yes | - | | --type <type> | Test type (unit/integration/e2e) | No | unit | | --ide | Generate prompt for IDE LLM | No | true | | --output <path> | Save prompt to file | No | - |

Examples

Jest Unit Tests

smart-testgen generate --file src/calculator.ts --framework jest --type unit --ide

Vitest Integration Tests

smart-testgen generate --file src/api.ts --framework vitest --type integration --ide

Mocha E2E Tests

smart-testgen generate --file src/app.ts --framework mocha --type e2e --ide

Save Prompt to File

smart-testgen generate --file src/utils.ts --framework jest --type unit --ide --output prompt.txt

Supported Frameworks

| Framework | Command | Description | |-----------|---------|-------------| | Jest | --framework jest | Most popular for React/Node.js | | Vitest | --framework vitest | Fast, Vite-native testing | | Mocha | --framework mocha | Flexible testing framework |

Supported Test Types

| Type | Command | Description | |------|---------|-------------| | Unit | --type unit | Test individual functions/components | | Integration | --type integration | Test module interactions | | E2E | --type e2e | Test complete user flows |

Programmatic Usage

import { TestGenerator } from 'smart-testgen';

const generator = new TestGenerator();

const result = await generator.generate({
  filePath: 'src/utils.ts',
  framework: 'jest',
  testType: 'unit',
  mode: 'ide'
});

console.log(result.prompt); // Copy this to your AI tool

Why smart-testgen?

✅ No API Costs

Never calls OpenAI, Anthropic, or any LLM API. Use your existing Copilot/Cursor subscription or free AI tools.

✅ Maximum Control

  • You decide which AI to use
  • You review prompts before sending
  • You control the output

✅ Privacy First

  • No code sent to external APIs by this tool
  • You control what gets sent to AI
  • Works completely offline (until you paste to AI)

✅ Framework Agnostic

  • Works with any AI tool
  • Not locked into one vendor
  • Future-proof

Workflow

┌─────────────────┐
│  Your Code      │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  smart-testgen  │  ← Generates prompt
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  Copy & Paste   │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  Your AI Tool   │  ← Copilot/Cursor/ChatGPT/Claude
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│  Test Code      │  ← Ready to use
└─────────────────┘

Help Commands

# Show version
smart-testgen --version

# Show help
smart-testgen --help

# Show framework information
smart-testgen help-frameworks

Examples

Example 1: React Component

smart-testgen generate --file src/components/Button.jsx --framework jest --type unit --ide

Example 2: API Service

smart-testgen generate --file src/services/userService.ts --framework vitest --type integration --ide

Example 3: Utility Functions

smart-testgen generate --file src/utils/validators.ts --framework mocha --type unit --ide

Tips

💡 Start simple - Try with a small file first to understand the prompt format

💡 Review prompts - Check the generated prompt before pasting to AI

💡 Adjust as needed - Modify prompts to match your project conventions

💡 Use --output - Save prompts for reuse or documentation

💡 Try different types - Experiment with unit, integration, and e2e tests

Requirements

  • Node.js 16.0.0 or higher
  • Any AI tool (Copilot, Cursor, ChatGPT, Claude, etc.)

Contributing

Contributions welcome! Please see the GitHub repository.

License

MIT © [Your Name]

Links


Made with ❤️ for developers who love AI-assisted testing