一键导入
qa-jest-writer
Generate Jest unit and integration tests for TypeScript/JavaScript projects with jest.mock, snapshots, code coverage, and describe/it patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate Jest unit and integration tests for TypeScript/JavaScript projects with jest.mock, snapshots, code coverage, and describe/it patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Master skill coordinating all QA skills through pipeline modes (full-cycle, docs-only, testcases-only, write-tests, report), formalized handoff chains, scheduler rules, and framework/language selection based on project context.
QA project memory with auto-update. Structured log of bugs, decisions, tests, regressions, environments. Automatically updated after every QA task. Archive system with searchable index for large projects. Trigger phrases (EN): "initialize memory", "init qa memory", "find known bug", "search memory", "show what was done", "check regressions", "memory status", "archive memory", "log a bug", "add decision", "memory summary", "what bugs do we know", "update memory", "show test log". Trigger phrases (UA): "ініціалізувати пам'ять", "знайти відомий баг", "пошук у пам'яті", "показати що було зроблено", "перевірити регресії", "статус пам'яті", "архівувати пам'ять", "залогувати баг", "додати рішення", "зведення пам'яті", "які баги відомі", "оновити пам'ять", "показати лог тестів", "що ми вирішили про", "які тестові середовища є".
Analyze OpenAPI/Swagger spec (JSON or YAML) against existing test files and generate an HTML coverage report with QA automation tasks. Use when user provides an OpenAPI spec file and wants to know test coverage status.
Generate accessibility tests for WCAG 2.2 compliance using axe-core, Pa11y, and Lighthouse with automated checks for ARIA patterns, keyboard navigation, color contrast, and screen reader support.
Manage and formalize API contracts from existing endpoints, swagger/JSON, network traffic, or developer interviews into OpenAPI specifications.
Autonomously explore live web applications using Playwright MCP to collect page structure, form fields, validation rules, API endpoints, and user flows for test case generation.
| name | qa-jest-writer |
| description | Generate Jest unit and integration tests for TypeScript/JavaScript projects with jest.mock, snapshots, code coverage, and describe/it patterns. |
| output_dir | tests/unit |
Write Jest unit and integration tests from test case specifications (Phase 2 output). Transform structured test cases into executable TypeScript/JavaScript tests using Jest's describe/it patterns, mocking, snapshots, and coverage tooling.
| Type | Scope | Focus |
|---|---|---|
| Unit | Isolated function/class testing | Single unit, mocked dependencies |
| Integration | Module interaction, service layer | Real or partial integration, fewer mocks |
{module}.test.ts or {module}.spec.tsUses Context7 MCP to fetch current Jest documentation when needed. Query for Jest API, matchers, or configuration to ensure generated tests align with latest Jest behavior.
| Pattern | Use Case |
|---|---|
describe / it / test | Group and define test cases |
beforeEach / afterEach | Setup and teardown per test |
jest.mock() | Mock entire modules (hoisted) |
jest.spyOn() | Spy on object methods |
| Snapshot testing | UI components, serializable output |
test.each | Parameterized / table-driven tests |
async/await, done | Async testing |
| Custom matchers | Domain-specific assertions |
| Assertion | Use |
|---|---|
toBe | Strict equality (===) |
toEqual | Deep equality |
toMatchObject | Partial object match |
toThrow | Error thrown |
toHaveBeenCalledWith | Mock call arguments |
resolves / rejects | Promise outcomes |
See references/assertions.md for full reference.
moduleNameMapper, transform, coverage@/ → src/)See references/config.md for configuration guide.
{module}.test.ts — Preferred (aligns with Jest default){module}.spec.ts — Alternative (common in Angular/Vue)Place tests next to source (__tests__/ or colocated) or in tests/ per project convention.
Can do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
references/patterns.md — Unit structure, mocking strategies, async, snapshots, error testingreferences/assertions.md — Complete Jest assertion reference by categoryreferences/config.md — jest.config, tsconfig paths, coverage, setupFilesreferences/best-practices.md — Anti-patterns, AAA, isolation, descriptive names| Symptom | Likely Cause | Fix |
|---|---|---|
| Module not found | Path/alias mismatch | Check moduleNameMapper in jest.config, tsconfig paths |
| Mock not working | Hoisting / import order | Use jest.mock() at top of file, before imports |
| Timeout | Async not resolved | Increase jest.setTimeout(), ensure promises resolve |
| Snapshot drift | Intentional change | Run jest -u to update; verify change is correct |
| Coverage gaps | Missing branches | Add tests for error paths, edge cases |
| Spy not called | Wrong target or timing | Verify spy on correct object, call after setup |