vitest-testing

Solid

Vitest unit testing for TypeScript/JavaScript in Oh My Brand! theme. Test setup, Web Component testing, mocking patterns, and coverage. Use when writing unit tests for frontend code.

Testing & QA 364 stars 68 forks Updated today MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
85
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Vitest Testing Unit testing TypeScript/JavaScript code with Vitest for the Oh My Brand! WordPress FSE theme. --- ## When to Use - Writing unit tests for Web Components - Testing utility functions (debounce, throttle, etc.) - Mocking browser APIs (IntersectionObserver, matchMedia) - Achieving code coverage requirements --- ## Configuration | File | Template | Purpose | |------|----------|---------| | [vitest.config.ts](references/vitest.config.ts) | Vitest configuration | Test settings and coverage | | [setup.ts](references/setup.ts) | Test setup | Browser API mocks | --- ## Test Templates | Template | Purpose | |----------|---------| | [web-component.test.ts](references/web-component.test.ts) | Web Component tests | | [debounce.test.ts](references/debounce.test.ts) | Utility function tests | | [mocking-patterns.ts](references/mocking-patterns.ts) | Mocking examples | --- ## Test Structure ```typescript import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; describe('ComponentName', () => { let element: HTMLElement; beforeEach(() => { document.body.innerHTML = `<my-component></my-component>`; element = document.querySelector('my-component')!; }); afterEach(() => { document.body.innerHTML = ''; }); it('should initialize correctly', () => { expect(element).toBeDefined(); }); }); ``` --- ## Mock Patterns Quick Reference ### Mock Functions ```typescript const mockFn = vi.fn(); moc...

Details

Author
majiayu000
Repository
majiayu000/claude-skill-registry
Created
5 months ago
Last Updated
today
Language
HTML
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category