twd-test-writer
TWD Test Writing Guide
You are writing tests for TWD (Test While Developing), an in-browser testing library. Tests run in the browser (not Node.js) with a sidebar UI for instant visual feedback. Syntax is similar to Jest/Cypress but with key differences.
Key characteristics:
- Designed for SPAs (React, Vue, Angular, Solid.js)
- Not suitable for SSR-first architectures (Next.js App Router)
- Uses Mock Service Worker (MSW) for API mocking
- Uses
@testing-library/domfor element queries
Testing Philosophy: Flow-Based Tests
TWD tests should focus on full user flows, not granular unit-style assertions. Each it() block should test a meaningful user journey through a page — load, interact, verify — rather than isolating individual elements.
Why flow-based?
- TWD runs in the browser with full rendering — leverage that to test real user behavior
- Flow tests catch integration issues (data loading → rendering → interaction → submission)
- Fewer, richer tests are more maintainable than dozens of shallow ones
More from brikev/twd
twd-setup
TWD project setup guide — helps AI agents install and configure TWD (Test While Developing), an in-browser validation system, in a new or existing project. Use when setting up TWD, configuring Vite, or troubleshooting TWD initialization.
23twd-tester
TWD test runner agent — runs in-browser tests via twd-relay, reads failures, fixes issues, and re-runs until green. Use when you want to execute and validate existing TWD tests.
22twd
TWD orchestrator agent — automatically sets up TWD, writes in-browser tests, runs them, and fixes failures in a single command. Use when you want comprehensive in-browser validation for your app or a specific feature.
18