What problem does it solve?
Tests in packages/playground and packages/playground-ui often mock internal hooks with vi.mock, which hides cache, gating, and transport bugs and lets fixtures drift silently from the real @mastra/client-js SDK contract. This Skill enforces a testing strategy where the real client SDK, React Query cache, and component code paths run against MSW-mocked network boundaries with fully typed fixtures.
Core Features & Use Cases
- MSW-based test generation: Produces Vitest tests that render components through MastraReactProvider, QueryClientProvider, and MemoryRouter while MSW handlers intercept HTTP requests at the network layer.
- Typed fixture enforcement: Requires every fixture to be typed with response types re-exported from @mastra/client-js, banning
as any casts and bespoke inline test shapes so typecheck failures surface contract drift.
- Testing recipes: Provides patterns for loading states via promise gates, query gating assertions with vi.fn-wrapped handlers, feature-flag toggling, and query-string-dependent responses.
- Use Case: When adding a new agents list page to the playground, generate a test that serves a typed ListStoredAgentsResponse fixture through MSW, asserts the rendered output, and verifies gating logic never fires unauthorized endpoint calls.
Quick Start
Write a Vitest test for the agents page in packages/playground that uses MSW handlers and typed @mastra/client-js fixtures instead of mocking hooks.