unit-test-vue-pinia
# Vue 3 + TypeScript + Vitest + Pinia Unit Testing Guide ## Component Tests ### Basic Component Test ```typescript import { describe, it, expect, beforeEach } from 'vitest'; import { mount } from '@vue/test-utils'; import { createTestingPinia } from '@pinia/testing'; import Counter from '@/components/Counter.vue'; describe('Counter.vue', () => { it('renders initial count', () => { const wrapper = mount(Counter, { global: { plugins: [createTestingPinia()], }, }); expect(wrapper.text()).toContain('0'); }); it('increments count on button click', async () => { const wrapper = mount(Counter, { global: { plugins: [createTesting
Bron: github.com/github/awesome-copilot/tree/main/skills/unit-test-vue-pinia · Licentie: MIT
Volledige uitleg, versies en download zijn beschikbaar voor leden — lidmaatschap is gratis.