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

@intentsolutionsio/unit-test-generator

v1.0.0

Published

Automatically generate comprehensive unit tests from source code with multiple testing framework support

Readme

Unit Test Generator Plugin

Automatically generate comprehensive unit tests from source code with intelligent framework detection and best practices.

Features

  • Multi-framework support - Jest, pytest, JUnit, Go testing, RSpec, and more
  • Intelligent test generation - Analyzes code to create relevant test cases
  • Complete coverage - Happy paths, edge cases, error handling
  • Mock generation - Automatic mocking of external dependencies
  • Best practices - Arrange-Act-Assert, descriptive names, proper structure

Installation

/plugin install unit-test-generator@claude-code-plugins-plus

Usage

Generate tests for a file

/generate-tests src/utils/validator.js

Specify framework explicitly

/generate-tests --framework pytest src/api/users.py

Use shortcut

/gut models/UserModel.ts

What Gets Generated

The plugin creates test files with:

  1. Proper imports and setup - Framework-specific boilerplate
  2. Test suite organization - Logical grouping of related tests
  3. Comprehensive test cases:
    • Valid inputs (typical scenarios)
    • Invalid inputs (null, undefined, wrong types)
    • Boundary conditions (limits, empty collections)
    • Error scenarios (exceptions, failures)
    • State changes (when applicable)
  4. Mocks and stubs - For external dependencies
  5. Clear assertions - Validating expected outcomes
  6. Helpful comments - Explaining complex scenarios

Supported Languages & Frameworks

| Language | Frameworks | |----------|------------| | JavaScript/TypeScript | Jest, Mocha, Vitest, Jasmine | | Python | pytest, unittest, nose2 | | Java | JUnit 5, TestNG | | Go | testing package | | Ruby | RSpec, Minitest | | C# | xUnit, NUnit, MSTest | | PHP | PHPUnit | | Rust | cargo test |

Example Output

For a JavaScript validation function:

// Input: src/utils/validator.js
function validateEmail(email) {
  if (!email) return false;
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}

// Generated: src/utils/validator.test.js
describe('validateEmail', () => {
  it('should return true for valid email addresses', () => {
    expect(validateEmail('[email protected]')).toBe(true);
    expect(validateEmail('[email protected]')).toBe(true);
  });

  it('should return false for invalid email addresses', () => {
    expect(validateEmail('notanemail')).toBe(false);
    expect(validateEmail('@example.com')).toBe(false);
    expect(validateEmail('user@')).toBe(false);
  });

  it('should return false for null or undefined inputs', () => {
    expect(validateEmail(null)).toBe(false);
    expect(validateEmail(undefined)).toBe(false);
    expect(validateEmail('')).toBe(false);
  });

  it('should handle edge cases', () => {
    expect(validateEmail('[email protected]')).toBe(true); // Minimal valid email
    expect(validateEmail('[email protected]')).toBe(true); // Multiple dots
  });
});

Best Practices

The plugin follows testing best practices:

  • Descriptive names - Clear what is tested and expected result
  • Arrange-Act-Assert - Clear test structure
  • Test isolation - No shared state between tests
  • Single responsibility - One concept per test
  • Mock external dependencies - Database calls, API requests, etc.
  • Test both paths - Success and failure scenarios
  • Edge cases - Boundaries, nulls, empty values

Requirements

  • Claude Code CLI
  • Testing framework installed in project (e.g., npm install --save-dev jest)

Tips

  1. Review generated tests and adjust for your specific needs
  2. Add integration tests for complex workflows
  3. Update tests when code changes
  4. Aim for high coverage but prioritize meaningful tests
  5. Use generated tests as a starting point, not final solution

License

MIT