reviewing-unit-tests

Reviews Vitest unit-test diffs in ComfyUI_frontend against documented testing rules.

2.0k|679|Updated Jun 13, 2024
One-click install
npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill reviewing-unit-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reviewing-unit-tests
Source: https://github.com/Comfy-Org/ComfyUI_frontend/tree/main/.claude/skills/reviewing-unit-tests
Command: npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill reviewing-unit-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reviewing unit-test pull requests is inconsistent when reviewers rely on memory or legacy snippets instead of current repo rules, letting mocked i18n, type casts, and non-behavioral tests slip through.

Core Features & Use Cases

  • Structured Review Workflow: Classifies each test (component, store, composable, util, bugfix regression), names the behavior it proves, and checks it against authoritative docs in a defined precedence order.
  • Red-Flag Detection: Provides a 30-second checklist for common failure modes such as new @vue/test-utils imports, vi.mock('vue-i18n'), as any casts, alias-by-renaming helpers, and unproven regression tests.
  • Use Case: When reviewing a bugfix PR that adds a Pinia store test, use this Skill to verify the test uses createTestingPinia({ stubActions: false }), avoids unnecessary casts, and actually fails on pre-fix code before approving.

Quick Start

Review the unit-test changes in this pull request and flag any violations of the repo's Vitest testing rules.

Frequently Asked Questions about reviewing-unit-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Vitest unit tests in a pull request?

Identify the test type first, name the behavior it proves in one sentence, then check it against the repo's authoritative testing docs. Scan for red flags like mocked i18n, type casts, and non-behavioral assertions before giving a verdict.

Should new Vue component tests use @vue/test-utils or @testing-library/vue?

New component tests in ComfyUI_frontend must use @testing-library/vue with @testing-library/user-event. The @vue/test-utils snippets in older docs are legacy examples, and new imports of it should be flagged in review.

Can I mock vue-i18n in Vue component tests?

No, vue-i18n must never be mocked in component tests. Use a real createI18n instance following the shared testI18n setup in the repo's test utilities, as documented in the Vitest patterns guide.

When is vi.mocked() required instead of a type cast?

Use vi.mocked() when configuring mock return values or inspecting mock.calls and mock.results, since it narrows types correctly. Assertion-only references like toHaveBeenCalledWith need neither vi.mocked() nor casts.

How do I verify a bugfix regression test actually works?

Confirm the new test fails when run against the pre-fix code, or ask the author to demonstrate it. A regression test that passes on broken code does not pin the bug and should be rejected.