- Home
- Skills
- Shunsukehayashi
- Miyabi
- Test Generator
test-generator_skill
- TypeScript
14
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill shunsukehayashi/miyabi --skill test-generator- SKILL.md3.8 KB
Overview
This skill generates comprehensive unit, integration, and end-to-end tests for TypeScript projects to quickly raise coverage and enforce reliable behavior. It produces Vitest-compatible tests, Playwright E2E scaffolding, and Testing Library component specs following an Arrange-Act-Assert structure. Use it to create new tests, fill gaps, or bootstrap a testing framework for a codebase.
How this skill works
The generator analyzes function signatures, exported modules, and common usage patterns to propose test suites covering happy paths, edge cases, error conditions, and async flows. It emits co-located test files, mocking examples using vi, and reusable templates (beforeEach, spies, mock modules). It also outputs coverage targets and commands to run tests with coverage enabled.
When to use it
- Adding tests for new or recently changed functions
- Improving test coverage to meet an 80% threshold
- Bootstrapping Vitest, Playwright, or Testing Library tests in a TypeScript repo
- Converting manual QA scenarios into automated tests
- Preparing code for refactors or CI gatekeeping
Best practices
- Co-locate unit tests next to source files and use __tests__ for integration suites
- Follow AAA (Arrange-Act-Assert) in each test for clarity
- Mock external dependencies with vi.mock and clear mocks in beforeEach
- Cover happy path, edge cases, error cases, and async behavior explicitly
- Use it.each for repetitive table-driven edge-case checks
- Run tests with --coverage and aim for at least 80% on statements, branches, functions, and lines
Example use cases
- Generate unit tests for a utility module (sum, divide) including edge cases and error throws
- Create async tests that assert resolved values and rejected promises for API clients
- Scaffold component tests with Testing Library and simulate user interactions
- Mock database modules and verify calls using spies and vi.fn
- Produce integration suites that exercise multiple modules and validate end-to-end flows
FAQ
Primarily Vitest for unit/integration, Playwright for E2E, and Testing Library for component tests.
What coverage targets does the skill enforce?
Recommended targets are 80% for statements, branches, functions, and lines, with a generated npm test -- --coverage command.