skills/vitest_runner/SKILL.md
Modern JavaScript/TypeScript testing with Vitest including mocking and coverage.
npx skillsauth add vuralserhat86/antigravity-agentic-skills vitest_runnerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Modern JavaScript/TypeScript testing with Vitest including mocking and coverage.
import { describe, it, expect } from 'vitest';
describe('math', () => {
it('should add numbers', () => {
expect(1 + 1).toBe(2);
});
it('should throw on invalid input', () => {
expect(() => divide(1, 0)).toThrow('Division by zero');
});
});
import { vi, describe, it, expect } from 'vitest';
// Mock module
vi.mock('./api', () => ({
fetchUser: vi.fn().mockResolvedValue({ id: 1 })
}));
// Mock function
const callback = vi.fn();
callback('arg');
expect(callback).toHaveBeenCalledWith('arg');
it('should fetch data', async () => {
const data = await fetchData();
expect(data).toEqual({ id: 1 });
});
it('should reject on error', async () => {
await expect(fetchData()).rejects.toThrow('Error');
});
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
it('should handle click', async () => {
const onClick = vi.fn();
render(<Button onClick={onClick}>Click</Button>);
await userEvent.click(screen.getByRole('button'));
expect(onClick).toHaveBeenCalled();
});
Kaynak: Vitest Official Documentation & Vite + Testing Best Practices
vitest.config.ts dosyasının Vite ayarlarıyla senkronize olduğunu doğrula.jsdom veya happy-dom, backend için node environment'ı seç.setup.ts içinde global mock'ları tanımla.vi.mock() ile izole ederek sadece hedef üniteyi test et.expect metodlarını kullanarak beklenen sonuçları (be.truthy, toEqual, toBeCalled) doğrula.toMatchSnapshot() ile yakala.watch modunda tutarak anlık geri bildirim al.v8 veya istanbul provider kullanarak test kapsamını raporla.vi.clearAllMocks() ile testler arası veri kirliliğini (Pollution) önle.| Aşama | Doğrulama |
|-------|-----------|
| 1 | Test dosyaları *.test.ts veya *.spec.ts formatında mı? |
| 2 | Asenkron kodlar (async/await) doğru handle ediliyor mu? |
| 3 | Karmaşık nesne karşılaştırmalarında toBe (referans) yerine toEqual (değer) mi kullanıldı? |
Vitest Runner v1.5 - With Workflow
tools
Production-tested setup for Zustand state management in React. Includes patterns for persistence, devtools, and TypeScript patterns. Prevents hydration mismatches and render loops.
development
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
development
--- name: websocket_engineer router_kit: FullStackKit description: WebSocket specialist for real-time communication systems. Invoke for Socket.IO, WebSocket servers, bidirectional messaging, presence systems. Keywords: WebSocket, Socket.IO, real-time, pub/sub, Redis. triggers: - WebSocket - Socket.IO - real-time communication - bidirectional messaging - pub/sub - server push - live updates - chat systems - presence tracking role: specialist scope: implementation output-format:
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.