vitest
Use when writing or modifying Vitest tests to follow best practices for test structure, assertions, mocking, and coverage
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when writing or modifying Vitest tests to follow best practices for test structure, assertions, mocking, and coverage
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when writing Vague (.vague) files that need realistic test data using faker generators for names, emails, addresses, dates, and more
Use when writing Vague (.vague) files - a declarative language for generating realistic test data with superposition, constraints, and cross-references
Use when working with JSON Schema for validation, including draft-07, 2019-09, and 2020-12 specifications
Use when adding syntax highlighting for custom languages to Prism.js, used by Docusaurus and many documentation sites
Use when configuring Spectral for API linting, creating custom rulesets, and validating OpenAPI or AsyncAPI specifications
Use when developing TypeScript npm packages including tsconfig, package.json exports, dual CJS/ESM builds, and publishing
| name | vitest |
| description | Use when writing or modifying Vitest tests to follow best practices for test structure, assertions, mocking, and coverage |
import { describe, it, expect, vi, beforeEach } from 'vitest';
describe('MyModule', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('should handle basic case', () => {
expect(myFunction('input')).toBe('expected');
});
it('should throw on invalid input', () => {
expect(() => myFunction(null)).toThrow('Invalid input');
});
});
describe for grouping, it for individual testsexpect(value).toBe(), .toEqual(), .toMatchObject(), .toThrow()async/await or return Promise; use vi.waitFor() for pollingvi.fn(), vi.spyOn(), vi.mock('module')beforeEach, afterEach, beforeAll, afterAllexpect(value).toMatchSnapshot(), update with -u flagvi.useFakeTimers() for time-dependent tests