jest-vitest

Generate Jest/Vitest unit tests for JavaScript and TypeScript codebases with mocking, async validation, and branch coverage.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Samuelca6399/AbsolutelySkilled --skill jest-vitest-samuelca6399
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jest-vitest
Source: https://github.com/Samuelca6399/AbsolutelySkilled/tree/main/skills/jest-vitest
Command: npx skills add https://github.com/Samuelca6399/AbsolutelySkilled --skill jest-vitest-samuelca6399

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you write correct, maintainable unit tests for JavaScript and TypeScript using Jest or Vitest, including mocking, async behavior, snapshots, and coverage that actually reveals weak branches.

Core Features & Use Cases

  • Test authoring with Jest/Vitest vocabulary: Generate tests using describe/it/expect patterns with clear Arrange-Act-Assert structure.
  • Mocking at the right boundaries: Apply vi.fn, jest.fn, vi.mock, and spying strategies to isolate external dependencies.
  • Async, snapshots, and coverage guidance: Handle promises, fake timers, snapshot testing decisions, and branch-focused coverage improvements.
  • Use case: When migrating a React/TS test suite from Jest to Vitest, use this skill to update configuration, convert mocks, keep behavior consistent, and prevent false positives.

Quick Start

Activate jest-vitest to generate a Vitest unit test that mocks a module and verifies behavior using Arrange-Act-Assert.

Frequently Asked Questions about jest-vitest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write reliable Jest or Vitest unit tests with proper mocking?▼

To write reliable Jest or Vitest unit tests, use describe/it/expect patterns with clear Arrange-Act-Assert structure, applying vi.fn or jest.fn to isolate external dependencies and validate behavior effectively.

How do I migrate a test suite from Jest to Vitest without breaking mocks?▼

Migrating from Jest to Vitest involves updating test runner configuration, converting jest.mock to vi.mock strategies, and verifying async behavior to keep test outcomes consistent and prevent false positives.

What is the best way to handle async logic and fake timers in Vitest?▼

Handling async logic and fake timers in Vitest requires dedicated test patterns to validate promise resolution and timer-driven behavior, ensuring your unit tests accurately capture asynchronous code execution flows.

How do I improve code coverage and focus on weak branches in Jest?▼

Improving code coverage in Jest requires branch-focused coverage practices that identify untested logic paths, ensuring your unit tests validate critical execution branches rather than just hitting lines of code.

When should I use snapshot testing in my JavaScript unit tests?▼

Snapshot testing in JavaScript should be used to detect unexpected UI or data structure changes, balancing snapshot decisions with explicit assertions to maintain dependable unit tests without creating brittle test suites.

Can I use this for end-to-end or browser testing?▼

No, this focuses strictly on unit testing JavaScript and TypeScript codebases with Jest or Vitest, applying guardrails to avoid e2e or browser testing and concentrate on isolated module behavior validation.