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

ai-testpilot

v1.1.2

Published

An AI-powered zero-config CLI for generating test stubs for Node.js projects

Readme

AI TestPilot

Languages: English | 中文

Automatically generate Jest test cases for your projects. Zero configuration, ready to use out of the box.

Quick Start

Option 1: Global Installation (Recommended)

# Install
npm install -g ai-testpilot

# Use
ai-testpilot generate                    # Scan src/ directory and generate tests
ai-testpilot generate --target ./lib    # Scan specific directory
ai-testpilot run                         # Run tests
ai-testpilot report                      # View report location

Option 2: Project Installation

# Install to project
npm install --save-dev ai-testpilot

# Add to package.json scripts
{
  "scripts": {
    "test:generate": "ai-testpilot generate", 
    "test:run": "ai-testpilot run",
    "test:report": "ai-testpilot report"
  }
}

# Use
npm run test:generate
npm run test:run
npm run test:report

Option 3: One-time Use

# No installation required, use directly
npx ai-testpilot generate
npx ai-testpilot run
npx ai-testpilot report

It's that simple!

Example

Suppose you have this project structure:

my-project/
├── src/
│   ├── utils.js
│   ├── api.js  
│   └── components/
│       └── Button.js
└── package.json

After running ai-testpilot, it will automatically generate:

my-project/
├── src/
│   └── ... (your source code)
├── tests/          # 🆕 Auto-generated test files
│   ├── utils.test.js
│   ├── api.test.js
│   └── components/
│       └── Button.test.js
├── coverage/       # 🆕 Test coverage report
└── jest.config.js  # 🆕 Jest configuration file

Command Reference

| Command | Description | Options | |---------|-------------|---------| | ai-testpilot generate | Scan source files and generate test files | --target <dir> Specify scan directory (default: src)--output <dir> Specify output directory (default: tests) | | ai-testpilot run | Execute all tests and generate coverage report | None | | ai-testpilot report | Show test report location | None | | ai-testpilot | Show help information | None |

Usage Examples

# Basic usage
ai-testpilot generate
ai-testpilot run

# Custom directories
ai-testpilot generate --target ./lib --output ./spec
ai-testpilot generate --target ./components

# Complete workflow
ai-testpilot generate && ai-testpilot run && ai-testpilot report

Team Project Recommended Usage

Project Installation + npm scripts

# Project maintainer
npm install --save-dev ai-testpilot

Add to package.json:

{
  "scripts": {
    "test": "ai-testpilot run",
    "test:generate": "ai-testpilot generate",
    "test:report": "ai-testpilot report",
    "test:all": "npm run test:generate && npm run test && npm run test:report",
    "test:components": "ai-testpilot generate --target ./src/components"
  }
}

Team members only need to:

# Generate test files
npm run test:generate

# Run tests
npm test

# View reports
npm run test:report

# One-click complete workflow
npm run test:all

# Generate tests only for components
npm run test:components

CI/CD Integration

# .github/workflows/test.yml
name: Test
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - run: npm install
      - run: npm run test:generate
      - run: npm test
      - run: npm run test:report

Different Usage Scenarios

Personal Projects

  • Recommended: npx ai-testpilot one-time use
  • Advantage: No installation required, available anytime

Team Projects

  • Recommended: Project installation + npm scripts
  • Advantage: Version consistency, easy collaboration

Continuous Integration

  • Recommended: Integrate into CI/CD pipeline
  • Advantage: Automated testing, code quality assurance

Features

Zero Configuration - No need to install Jest, TypeScript, or other dependencies
Smart Generation - Automatically generates reasonable test cases based on source code
Coverage Reports - Automatically generates detailed test coverage
Multiple Format Support - JavaScript, TypeScript, React components

Generated Test Example

Source File (src/utils.js)

export function add(a, b) {
  return a + b;
}

export function isEven(num) {
  return num % 2 === 0;
}

Auto-generated Test (tests/utils.test.js)

import { add, isEven } from '../src/utils.js';

describe('utils', () => {
  describe('add', () => {
    test('should add two numbers correctly', () => {
      expect(add(2, 3)).toBe(5);
      expect(add(-1, 1)).toBe(0);
    });
  });

  describe('isEven', () => {
    test('should return true for even numbers', () => {
      expect(isEven(2)).toBe(true);
      expect(isEven(4)).toBe(true);
    });
    
    test('should return false for odd numbers', () => {
      expect(isEven(1)).toBe(false);
      expect(isEven(3)).toBe(false);
    });
  });
});

Supported Project Types

  • Node.js projects
  • React projects
  • TypeScript projects
  • Mixed JS/TS projects

FAQ

Q: Do I need to modify my existing code?
A: No, ai-testpilot only generates test files and won't modify your source code.

Q: Can I modify the generated test files?
A: Yes, you can modify the test cases as needed after generation.

Q: Does it support projects with existing Jest configuration?
A: Yes, ai-testpilot will detect existing configuration and use it compatibly.

🤝 Contributing

Issues and Pull Requests are welcome!

🔗 Links


📜 License

MIT © Diana Tang