Intelligent unit test generator for frontend projects that detects existing test frameworks and generates comprehensive tests for functions, components, and modules. Use when you need to: (1) Add unit tests to existing codebases, (2) Set up testing infrastructure for new projects, (3) Generate test cases for specific functions or components, (4) Ensure architectural consistency in testing approach across projects. Supports Jest, Vitest, Mocha with React, Vue, Angular frameworks.
Ships in hubvue-fe-analysis-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
An intelligent assistant for creating and managing unit tests in frontend projects. This skill automatically detects your project's testing setup and generates appropriate, framework-consistent test code.
npm install
Generate tests for any file or component:
node scripts/detect-test-framework.js /path/to/project
node scripts/generate-test.js src/components/Button.js
Automatically identifies your project's testing stack:
Maintains your project's existing testing patterns:
const TestFrameworkDetector = require('./scripts/detect-test-framework');
const detector = new TestFrameworkDetector('./my-project');
const analysis = detector.detect();
console.log(analysis);
// Output: Frameworks, utilities, config files, recommendations
const TestGenerator = require('./scripts/generate-test');
const generator = new TestGenerator('./my-project', {
framework: 'jest',
react: true
});
const result = generator.generateForFile('src/components/Button.jsx');
// Returns: { testPath, testContent, analysis }
const TestConfigGenerator = require('./scripts/setup-test-config');
const config = new TestConfigGenerator('./my-project', 'jest', {
react: true,
typescript: true,
coverage: true
});
const files = config.writeConfigs(); // Creates config files
const deps = config.getDependencies(); // Returns required packages
describe('Button', () => {
it('renders without crashing', () => {
render(<Button />);
expect(screen.getByRole('button')).toBeInTheDocument();
});
it('handles click events', async () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick} />);
await userEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalled();
});
});
describe('Button', () => {
it('renders without crashing', () => {
const wrapper = mount(Button);
expect(wrapper.exists()).toBe(true);
});
it('emits click event', async () => {
const wrapper = mount(Button);
await wrapper.trigger('click');
expect(wrapper.emitted('click')).toBeTruthy();
});
});
describe('formatCurrency', () => {
it('formats numbers correctly', () => {
expect(formatCurrency(1234.56)).toBe('$1,234.56');
});
it('handles edge cases', () => {
expect(formatCurrency(null)).toBe('$0.00');
expect(formatCurrency(0)).toBe('$0.00');
});
});
{
framework: 'jest' | 'vitest' | 'mocha', // Test framework
assertionStyle: 'expect' | 'assert', // Assertion style
includeMocks: true, // Include mock generation
testType: 'unit' | 'integration' | 'e2e', // Test type
coverage: true, // Include coverage
environment: 'jsdom' | 'node' // Test environment
}
.test.js or .spec.js suffixdescribe blocks# Already has Jest configured
node scripts/generate-test.js src/components/Button.jsx
# Setup Vitest
node scripts/setup-test-config.js vitest '{"vue": true}'
# Generate tests
node scripts/generate-test.js src/components/Button.vue
# Detect setup
node scripts/detect-test-framework.js .
# Add new tests
node scripts/generate-test.js src/utils/format.js '{"framework": "mocha"}'
Executable Node.js scripts for test generation and configuration:
detect-test-framework.js - Analyzes existing testing setupgenerate-test.js - Creates test files from source codesetup-test-config.js - Generates testing configuration filesComprehensive documentation and guides:
Template files for common testing scenarios:
assets/react-component.template.test.jsx (opens in a new tab)assets/vue-component.template.test.js (opens in a new tab)package.json (opens in a new tab)references/framework-selection.md (opens in a new tab)references/test-patterns.md (opens in a new tab)scripts/detect-test-framework.js (opens in a new tab)scripts/generate-test.js (opens in a new tab)scripts/setup-test-config.js (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/hubvue-fe-analysis-skills:unit-test-generatorfrom hubvue-fe-analysis-skills
hubvue-fe-analysis-skills@cascade-code-general-misc-3 is listed by joshuarweaver/cascade-code-general-misc-3 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin hubvue-fe-analysis-skills3 skills in this plugin
/architecture-analysisComprehensive frontend architecture analyzer that identifies technology stacks, build tools, and architectural patterns. Use when you need to quickly understand a project's structure, dependencies, and technical configuration. Provides analysis for Vue/React/Angular frameworks, Node.js environments, package managers, TypeScript usage, linters, and architecture patterns with multiple output formats including executive summaries and visualizations./dependency-analysisEnhanced dependency analyzer with comprehensive markdown reporting and actionable recommendations. Use when you need to optimize frontend project dependencies, detect security vulnerabilities, identify unused packages, find duplicate functionality, analyze dependency impact, generate cleanup scripts, or produce detailed Markdown reports. Supports JavaScript, TypeScript, Vue, React, Angular, and modern build tools with parallel processing and incremental analysis capabilities.