This skill provides specialized guidance and implementation patterns for JavaScript testing using Jest and Vitest. It equips Claude with the expertise to handle sophisticated mocking requirements, such as isolating external dependencies, managing mock lifecycles to prevent state leakage, and simulating time-sensitive logic with fake timers. By enforcing best practices like proper mock restoration and avoiding implementation-detail testing, this skill ensures that test suites remain clean, reliable, and maintainable across both frontend and backend projects.
主要功能
01Full and partial module mocking for Jest and Vitest frameworks
02Precise function spying and call tracking using spyOn
03Sequential and conditional mock implementations for complex logic branching
04Fake timer implementation for testing debounces, timeouts, and delays
050 GitHub stars
06Automated mock lifecycle management with clear, reset, and restore patterns
使用场景
01Testing time-dependent features like auto-saving or rate-limiting without waiting
02Verifying that specific callbacks are triggered within complex UI components
03Isolating network requests or database modules during unit testing