Help us improve
Share bugs, ideas, or general feedback.
From unit-test-generator
Generates unit tests from source code for JS/TS (Jest/Vitest/Mocha), Python (pytest), Java (JUnit 5), Go, covering happy paths, edges, boundaries, errors with mocks.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin unit-test-generatorHow this skill is triggered — by the user, by Claude, or both
Slash command
/unit-test-generator:generating-unit-testsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automatically generate comprehensive unit tests from source code analysis covering happy paths, edge cases, boundary conditions, and error handling. Supports Jest, Vitest, Mocha (JavaScript/TypeScript), pytest (Python), JUnit 5 (Java), and Go testing with testify.
Generates unit tests for Python (pytest), JavaScript/TypeScript (Jest), Java (JUnit), Go code with coverage focus, edge cases, mocks, and fixtures.
Generates unit tests matching project patterns and frameworks like Jest/Vitest (JS/TS), pytest (Python), Go testing, JUnit (Java), RSpec (Ruby).
Generates unit tests for code or functions, analyzing inputs, paths, edges, and errors. Detects project test framework (pytest, Jest, etc.), applies mocks, matches style, and writes files after confirmation.
Share bugs, ideas, or general feedback.
Automatically generate comprehensive unit tests from source code analysis covering happy paths, edge cases, boundary conditions, and error handling. Supports Jest, Vitest, Mocha (JavaScript/TypeScript), pytest (Python), JUnit 5 (Java), and Go testing with testify.
jest, vitest, pytest, junit-jupiter, or Go testing)__tests__/, tests/, spec/, or *_test.go)jest.mock, unittest.mock, Mockito, or gomock)npm test, pytest, go test)src/utils/parser.ts without __tests__/parser.test.ts).null, undefined, maximum values.*.test.ts, *.spec.js, test_*.py).describe/context blocks by function name.beforeEach/afterEach for setup and teardown.| Error | Cause | Solution |
|---|---|---|
Cannot find module on import | Test file path does not match project module resolution | Check tsconfig.json paths and moduleNameMapper in Jest config |
| Mock not intercepting calls | Mock defined after module import caches the real implementation | Move jest.mock() calls to the top of the file before any imports |
| Async test timeout | Promise never resolves due to missing await or unhandled rejection | Add await before async calls; increase timeout with jest.setTimeout() |
| Tests pass alone but fail together | Shared mutable state leaking between tests | Reset state in afterEach; avoid module-level variables; use jest.isolateModules() |
| Snapshot mismatch on first run | No existing snapshot baseline | Run with --updateSnapshot on first execution to create the baseline |
Jest test for a string utility:
import { slugify } from '../src/utils/slugify';
describe('slugify', () => {
it('converts spaces to hyphens', () => {
expect(slugify('hello world')).toBe('hello-world');
});
it('lowercases all characters', () => {
expect(slugify('Hello World')).toBe('hello-world');
});
it('removes special characters', () => {
expect(slugify('hello@world!')).toBe('helloworld');
});
it('handles empty string', () => {
expect(slugify('')).toBe('');
});
it('trims leading and trailing whitespace', () => {
expect(slugify(' spaced ')).toBe('spaced');
});
});
pytest test for a data validator:
import pytest
from myapp.validators import validate_email
class TestValidateEmail:
def test_accepts_valid_email(self):
assert validate_email("user@example.com") is True
def test_rejects_missing_at_sign(self):
assert validate_email("userexample.com") is False
def test_rejects_empty_string(self):
assert validate_email("") is False
def test_rejects_none(self):
with pytest.raises(TypeError):
validate_email(None)