Vitest-specific testing utilities — vi.mock, vi.fn, fake timers, MSW. Use when writing tests with Vitest, mocking dependencies, or setting up test infrastructure.
70
Quality
61%
Does it follow best practices?
Impact
82%
0.83xAverage score across 3 eval scenarios
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/framework/tech-vitest/SKILL.mdMSW HTTP API Mocking
MSW used for HTTP mocking
100%
100%
setupServer with handlers
100%
100%
server.listen in beforeAll
100%
100%
onUnhandledRequest error
100%
100%
server.resetHandlers in afterEach
100%
100%
server.close in afterAll
100%
100%
server.use for error override
100%
100%
No direct HTTP client mock
100%
100%
HttpResponse.json used
100%
100%
Handlers in separate file
100%
100%
Without context: $0.4675 · 1m 53s · 26 turns · 31 in / 6,304 out tokens
With context: $0.5132 · 1m 39s · 29 turns · 1,358 in / 4,832 out tokens
Fake Timers and Time Control
vi.useFakeTimers called
100%
100%
vi.useRealTimers in afterEach
100%
100%
vi.useFakeTimers in beforeEach
100%
100%
vi.advanceTimersByTime used
100%
100%
vi.runAllTimers or advanceTimersByTime for polling
100%
100%
vi.setSystemTime for date control
100%
100%
vi.fn() for callback tracking
100%
100%
Callback not called before delay
100%
100%
Multiple calls collapse to one
100%
100%
Expired token test uses time control
100%
100%
Without context: $0.4176 · 1m 53s · 21 turns · 74 in / 6,879 out tokens
With context: $0.4660 · 1m 38s · 26 turns · 59 in / 5,325 out tokens
Module Mocking and Assertions
vi.mock for email module
100%
0%
vi.mock for promotions module
100%
0%
vi.importActual for partial mock
100%
0%
vi.spyOn on analytics
100%
100%
mockClear or mockReset in beforeEach
100%
40%
mockRestore for spies
25%
100%
toHaveBeenCalledWith assertion
100%
100%
rejects.toThrow for async errors
100%
100%
toEqual or toMatchObject for objects
100%
87%
vi.mock hoisting respected
100%
0%
sendWelcomeEmail mock resolved value
100%
0%
Without context: $0.4212 · 1m 38s · 26 turns · 71 in / 5,693 out tokens
With context: $0.8530 · 2m 45s · 39 turns · 1,044 in / 9,566 out tokens
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.