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

jestsmith

v1.4.0

Published

An AI powered package that takes in code and an optional description and generates jest testcases for that code"

Readme

🧪 JestSmith

🧠💥 Auto-generate Jest test cases for your JavaScript/TypeScript code using AI — so you can ship confidently without writing a single test.

npm GitHub Workflow Status License


🚀 What is JestSmith?

JestSmith is a CLI tool that uses AI to automatically generate Jest test cases for any JavaScript or TypeScript project, including:

  • ✅ React components
  • ✅ Node.js backend logic
  • ✅ NestJS modules (controllers, services, routes)
  • ✅ Any framework or custom business logic

✨ Features

  • ⚡ One-command test generation
  • 📂 Folder support (generate tests for entire modules)
  • 🧠 AI-powered (works better with a short explanation)
  • 📝 Outputs clean, readable, idiomatic Jest tests
  • 🧰 Framework-agnostic (React, Node, Angular, NestJS, etc.)
  • 🛠️ TypeScript-native

📦 Installation

npm install -g jestsmith

🧑‍💻 Usage

1. Add your OpenAI API_KEY

export OPENAI_API_KEY=<Your OpenAI API KEY>

Or

Add this to your project's local .env file:

OPENAI_API_KEY=<Your OpenAI API KEY>

2. Generate test for a single file

jestsmith ./src/components/LoginForm.tsx --describe "A login form with Formik + Yup that hits a login API on submit"

3. Generate test for a whole folder (e.g., a NestJS module)

jestsmith ./src/modules/user --describe "This is a NestJS User module with CRUD operations"

✅ The tool will:

  • Parse each file
  • Understand file relationships (controllers, services, routes)
  • Generate relevant Jest test cases into a __tests__/ folder or in the --out-dir

🛠 CLI Options

| Option | Description | | ------------ | --------------------------------------------------------- | | --describe | (optional) Add context so the AI writes better tests | | --outDir | (optional) Customize the output folder for test files | | --dry-run | (coming soon) Preview the generated output without saving |


📁 Example

Given a file like:

// LoginForm.tsx
const LoginForm = () => {
  const formik = useFormik({
    /* yup validation */
  });

  const handleSubmit = async () => {
    await api.login(formik.values);
  };

  return <form onSubmit={handleSubmit}>...</form>;
};

Running:

jestsmith LoginForm.tsx --describe "React login form using Formik and Yup"

Might generate:

// __tests__/LoginForm.test.tsx
import { render, fireEvent } from '@testing-library/react';
import LoginForm from '../LoginForm';

describe('LoginForm', () => {
  it('calls login API on successful form submission', async () => {
    ...
  });
});

📚 How It Works

Under the hood, JestSmith:

  1. Uses AST parsing to understand your code structure
  2. Sends intelligently prepared prompts to an LLM (like GPT)
  3. Applies Jest syntax best practices
  4. Writes test files based on your code and explanation

💡 Tips for Best Results

  • ✅ Provide a short --describe for context
  • ✅ Keep functions/components modular and clean
  • ✅ Use TypeScript where possible for better inference
  • ✅ Use meaningful function/component names

🤖 Roadmap

  • [ ] --dry-run to preview generated code
  • [ ] Support .jestsmithrc config files
  • [ ] Built-in Prettier formatting
  • [ ] Estimate test coverage based on function count
  • [ ] VSCode extension support

🧑‍🎤 Contributing

PRs, ideas, and contributions are welcome!

🔧 Local Dev

# clone the repo
git clone https://github.com/ahsansheikh94/jestsmith.git
cd jestsmith

# install deps
npm install

# build the CLI
npm run build

# test locally
node dist/bin/index.js ./src/example.ts --describe "Login form with API call"

📦 Publishing

This repo uses Changesets for automated versioning + changelogs + npm publishing.

To release:

npx changeset       # describe the change
git commit -am "chore: version bump"
git push

GitHub Actions will:

  • Create a release PR
  • Tag version
  • Publish to npm automatically

You’ll need to set NPM_TOKEN in GitHub Secrets.


🪪 License

MIT © Ahsan Sheikh


🌍 Community

Found a bug? Have feature ideas?
Open an issue

Love the tool?
→ ⭐ Star it and share it with your team!