Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Frontend Development
github avatar

Unit Test Vue Pinia

github/awesome-copilotOfficial

This one helps you write and review unit tests for Vue 3 projects using Pinia for state management. It pushes you toward behavior-first testing: assert what the user sees or what the component emits, not internal implementation details. The Pinia guidance is opinionated and detailed, defaulting to createTestingPinia with vi.fn spies for action assertions, and it explicitly calls out when to use stubActions: false or real store instances. It includes a references/pinia-patterns.md file as your local source of truth, which is a smart touch for team consistency. The workflow is tight: identify the behavior boundary, set up the minimal Pinia config, drive through public inputs, assert outputs. If you're tired of brittle tests that break on refactors, this will nudge you toward the right patterns.

installs
1.8K
GitHub stars
40.5K
last updated
Aug 21, 2026
View on GitHubSave

Install

$ npx -y skills add github/awesome-copilot --skill unit-test-vue-pinia --agent claude-code

Installs into .claude/skills of the current project.

Files

unit-test-vue-pinia

Use this skill to create or review unit tests for Vue components, composables, and Pinia stores. Keep tests small, deterministic, and behavior-first.

Workflow

  1. Identify the behavior boundary first: component UI behavior, composable behavior, or store behavior.
  2. Choose the narrowest test style that can prove that behavior.
  3. Set up Pinia with the least powerful option that still covers the scenario.
  4. Drive the test through public inputs such as props, form updates, button clicks, emitted child events, and store APIs.
  5. Assert observable outputs and side effects before considering any instance-level assertion.
  6. Return or review tests with clear behavior-oriented names and note any remaining coverage gaps.

Core Rules

  • Test one behavior per test.
  • Assert observable input/output behavior first (rendered text, emitted events, callback calls, store state changes).
  • Avoid implementation-coupled assertions.
  • Access wrapper.vm only in exceptional cases when there is no reasonable DOM, prop, emit, or store-level assertion.
  • Prefer explicit setup in beforeEach() and reset mocks every test.
  • Use checked-in reference material in references/pinia-patterns.md as the local source of truth for standard Pinia test setups.

Pinia Testing Approach

Use references/pinia-patterns.md first, then fall back to Pinia's testing cookbook when the checked-in examples do not cover the case.

Default pattern for component tests

Use createTestingPinia as a global plugin while mounting. Prefer createSpy: vi.fn as the default for consistency and easier action-spy assertions.

const wrapper = mount(ComponentUnderTest, {
	global: {
		plugins: [
			createTestingPinia({
				createSpy: vi.fn,
			}),
		],
	},
});

By default, actions are stubbed and spied. Use stubActions: true (default) when the test only needs to verify whether an action was called (or not called).

Accepted minimal Pinia setups

The following are also valid and should not be flagged as incorrect:

  • createTestingPinia({}) when the test does not assert Pinia action spy behavior.
  • createTestingPinia({ initialState: ... }) or createTestingPinia({ stubActions: ... }) without createSpy, when the test only needs state seeding or action stubbing behavior and does not inspect generated spies.
  • setActivePinia(createTestingPinia(...)) in store/composable-focused tests (without mounting a component) when mocking/seeding dependent stores is needed.

Use createSpy: vi.fn when action spy assertions are part of the test intent.

Execute real actions only when needed

Use stubActions: false only when the test must validate the action's real behavior and side effects. Do not switch it on by default for simple "was called" assertions.

const wrapper = mount(ComponentUnderTest, {
	global: {
		plugins: [
			createTestingPinia({
				createSpy: vi.fn,
				stubActions: false,
			}),
		],
	},
});

Seed store state with initialState

const wrapper = mount(ComponentUnderTest, {
	global: {
		plugins: [
			createTestingPinia({
				createSpy: vi.fn,
				initialState: {
					counter: { n: 20 },
					user: { name: "Leia Organa" },
				},
			}),
		],
	},
});

Add Pinia plugins through createTestingPinia

const wrapper = mount(ComponentUnderTest, {
	global: {
		plugins: [
			createTestingPinia({
				createSpy: vi.fn,
				plugins: [myPiniaPlugin],
			}),
		],
	},
});

Getter override pattern for edge cases

const pinia = createTestingPinia({ createSpy: vi.fn });
const store = useCounterStore(pinia);

store.double = 999;
// @ts-expect-error test-only reset of overridden getter
store.double = undefined;

Pure store unit tests

Prefer pure store tests with createPinia() when the goal is to validate store state transitions and action behavior without component rendering. Use createTestingPinia() only when you need stubbed dependent stores, seeded test doubles, or action spies.

beforeEach(() => {
	setActivePinia(createPinia());
});

it("increments", () => {
	const counter = useCounterStore();
	counter.increment();
	expect(counter.n).toBe(1);
});

Vue Test Utils Approach

Follow Vue Test Utils guidance: https://test-utils.vuejs.org/guide/

  • Mount shallow by default for focused unit tests.
  • Mount full component trees only when integration behavior is the subject.
  • Drive behavior through props, user-like interactions, and emitted events.
  • Prefer findComponent(...).vm.$emit(...) for child stub events instead of touching parent internals.
  • Use nextTick only when updates are async.
  • Assert emitted events and payloads with wrapper.emitted(...).
  • Access wrapper.vm only when no DOM assertion, emitted event assertion, prop assertion, or store-level assertion can express the behavior. Treat it as an exception and keep the assertion narrowly scoped.

Key Testing Snippets

Emit and assert payload:

await wrapper.find("button").trigger("click");
expect(wrapper.emitted("submit")?.[0]?.[0]).toBe("Mango Mission");

Update input and assert output:

await wrapper.find("input").setValue("Agent Violet");
await wrapper.find("form").trigger("submit");
expect(wrapper.emitted("save")?.[0]?.[0]).toBe("Agent Violet");

Test Writing Workflow

  1. Identify the behavior boundary to test.
  2. Build minimal fixture data (only fields needed by that behavior).
  3. Configure Pinia and required test doubles.
  4. Trigger behavior through public inputs.
  5. Assert public outputs and side effects.
  6. Refactor test names to describe behavior, not implementation.

Constraints and Safety

  • Do not test private/internal implementation details.
  • Do not overuse snapshots for dynamic UI behavior.
  • Do not assert every field in large objects if only one behavior matters.
  • Keep fake data deterministic; avoid random values.
  • Do not claim a Pinia setup is wrong when it is one of the accepted minimal setups above.
  • Do not rewrite working tests toward deeper mounting or real actions unless the behavior under test requires that extra surface area.
  • Flag missing test coverage, brittle selectors, and implementation-coupled assertions explicitly during review.

Output Contract

  • For create or update, return the finished test code plus a short note describing the selected Pinia strategy.
  • For review, return concrete findings first, then missing coverage or brittleness risks.
  • When the safest choice is ambiguous, state the assumption that drove the chosen test setup.

References

  • references/pinia-patterns.md
  • Pinia testing cookbook: https://pinia.vuejs.org/cookbook/testing.html
  • Vue Test Utils guide: https://test-utils.vuejs.org/guide/
SKILL.md on GitHub

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

Repository
github.com/github/awesome-copilot
Categories
Frontend Development, Testing & QA, Git & Pull Requests, Code Review & Quality, AI & Agent Building, Python
First seen
Apr 16, 2026

More from github/awesome-copilot

All 318
  • Creating Oracle To Postgres Master Migration Plan1.8K
  • Creating Oracle To Postgres Migration Bug Report1.8K
  • Planning Oracle To Postgres Migration Integration Testing1.8K
  • Oo Component Documentation1.8K
  • Scaffolding Oracle To Postgres Migration Test Project1.7K
  • Gtm 0 To 1 Launch1.7K
  • Sandbox Npm Install1.7K
  • Semantic Kernel1.7K
  • Gtm Technical Product Pricing1.7K
  • Gdpr Compliant1.7K
  • Aws Cdk Python Setup1.6K
  • Gtm Ai Gtm1.6K
  • Gtm Board And Investor Communication1.6K
  • Dotnet Timezone1.6K
  • Gtm Partnership Architecture1.6K
  • Gtm Enterprise Account Planning1.6K
  • Quality Playbook1.6K
  • Gtm Enterprise Onboarding1.6K
  • Gtm Operating Cadence1.5K
  • Gtm Developer Ecosystem1.5K
  • Ruff Recursive Fix1.5K
  • Agent Owasp Compliance1.5K
  • Threat Model Analyst1.5K
  • Azure Architecture Autopilot1.5K

Recommended

More Frontend Development
1everyinc avatarce-frontend-designeveryinc/compound-engineering-pluginBuild web interfaces with genuine design quality, not AI slop. Use for any frontend work - landing pages, web apps, dashboards, admin panels, components, intera1.8Kinstalls
2github avataroo-component-documentationgithub/awesome-copilotCreate or update standardized object-oriented component documentation using a shared template plus mode-specific guidance for new and existing docs.1.8Kinstalls
3nexu-io avatardesign-taste-frontend-v1nexu-io/open-designThe original v1 taste-skill, preserved for projects depending on its exact behavior. The current default is `design-taste-frontend` (v2 experimental), which is 1.7Kinstalls
4nexu-io avatarimagegen-frontend-webnexu-io/open-designElite frontend image-direction skill for generating premium, conversion-aware website design references. CRITICAL OUTPUT RULE — generate ONE separate horizontal1.7Kinstalls
5nexu-io avatarimagegen-frontend-mobilenexu-io/open-designElite mobile app image-generation skill for creating premium, app-native screen concepts and flows. Designed for iOS, Android, and cross-platform mobile product1.7Kinstalls
6affaan-m avatarangular-developeraffaan-m/everything-claude-codeangular developer1.7Kinstalls