testing
Testing
Write reliable tests with Vitest v4 dual configuration.
Activation Conditions
- Writing or modifying tests
- Debugging test failures
- Setting up mocks
- Questions about test configuration
Quick Reference
| Action | Rule |
|---|---|
| Choose test type | test-unit-vs-integration.md |
| Mock modules | test-mock-patterns.md |
| Test stores | test-zustand-stores.md |
| Mock Connect APIs | mock-transport.md |
| Skip UI rendering tests | no-ui-rendering-tests.md |
Commands
bun run test # All tests (CI default)
bun run test:ci # Sequential for CI
bun run test:unit # Unit tests only
bun run test:integration # Integration tests only
bun run test:ui # Interactive UI
bun run test:watch # Watch mode
bun run test:coverage # Coverage report
Key Points
.test.ts= unit (Node.js),.test.tsx= integration (JSDOM)- Always use
test-utils/test-utils.tsxfor React component tests - Test that features are fully wired: UI elements must connect to actual functionality
Feature Completeness Testing
When implementing interactive features (buttons, forms, etc.):
- Verify event handlers call the correct functions with proper parameters
- Test that AbortSignals, callbacks, and other "plumbing" are passed through
- Don't assume UI presence means functionality works - test the connection
When to Use This Skill
- Writing
.test.tsor.test.tsxfiles - Mocking modules, stores, or transports
- Component behavior tests
NOT for: Multi-page user workflows → use e2e-tester
Rules
See rules/ directory for detailed guidance.
More from redpanda-data/console
react-best-practices
Client-side React performance optimization patterns.
72tanstack-router-migration
Migrate React applications from React Router to TanStack Router with file-based routing. Use when user requests: (1) Router migration, (2) TanStack Router setup, (3) File-based routing implementation, (4) React Router replacement, (5) Type-safe routing, or mentions 'migrate router', 'tanstack router', 'file-based routes'.
61code-standards
TypeScript, React, and JavaScript best practices enforced by Ultracite/Biome.
55security-scan
Resolve npm dependency vulnerabilities detected by security scans.
49api-patterns
Connect Query patterns for API calls. Use when working with mutations, queries, or data fetching.
48e2e-tester
Write and run Playwright E2E tests for Redpanda Console using testcontainers. Analyzes test failures, adds missing testids, and improves test stability. Use when user requests E2E tests, Playwright tests, integration tests, test failures, missing testids, or mentions 'test workflow', 'browser testing', 'end-to-end', or 'testcontainers'.
45