storybook-play-testing
Storybook Play Function Testing
Integration tests that render real components in a real browser. No mocks of what you own — mock only the server boundary, then test real behavior through real DOM interactions.
When to Use
- Setting up Storybook in a TanStack Start/Router project
- Writing stories for route-level pages or shared components
- Adding play function interaction tests
- Testing form flows, state transitions, edge cases
- Verifying responsive behavior (desktop + mobile)
The Problem: TanStack Start + Storybook
TanStack Start has SSR, server functions (createServerFn), Cloudflare Workers entry points, and a generated route tree — all of which crash in Storybook's browser-only preview. The solution is a three-layer mock strategy:
- Vite plugin — intercepts module resolution at build time
- Resolve aliases — redirects server imports to stub files
- Decorators — provides Router, Query, and Theme context
More from jonmumm/skills
dont-use-use-effect
>
59react-composable-components
>
41grill-me
>
32mutation-testing
Run and interpret Stryker mutation testing; kill survivors to reach ≥95% score. Use when running mutation tests, setting up Stryker, interpreting survivors, or verifying test quality after TDD.
32offensive-typesafety
>
31expo-testing
Build, install, and test Expo/React Native apps on simulators and physical devices. Use when asked to "run on simulator", "install on device", "test on phone", "run detox", "preview build", or "build and test".
30