What problem does it solve?
Writing and maintaining consistent unit and integration tests for the tldraw SDK is time-consuming and easy to get wrong, especially when you need correct Vitest patterns and reliable editor test setup.
Core Features & Use Cases
- Test file organization: Choose the right test location (alongside source files for unit tests, under src/test for integration tests, and alongside shape/tool implementations for targeted tests).
- Correct test harness selection: Use TestEditor for integration-style flows that include default shapes/tools, and use Editor when you need custom configurations.
- Common authoring patterns: Apply practical test utilities for pointer/keyboard simulation, state assertions, shape matching, undo/redo checks, fake timers, and vi.spyOn mocking with proper mockRestore cleanup.
Quick Start
Use the write-unit-tests skill to help you add a Vitest unit test for a failing behavior by following the recommended test location, editor setup (TestEditor vs Editor), and assertion style described in this guide.