Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes Vitest unit and integration tests for the tldraw SDK in packages/editor and packages/tldraw, using TestEditor.
52% 96%+43 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 12 of 23 without it.
I am working inside the packages/tldraw workspace directory and want to run only the unit tests that match the keyword 'SelectTool' once without staying in watch mode. What terminal command should I execute?
The command uses yarn test run --grep "SelectTool".
This test ran on v2. v5 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Unit and integration tests use Vitest and run from workspace directories, not the repo root.
Read a neighboring test before writing a new one — the existing suites are the specification for how we test, and they stay current in a way prose can't. Good starting points:
packages/tldraw/src/test/SelectTool.test.ts — tool state machine assertionspackages/tldraw/src/test/resizing.test.ts — pointer-driven interaction with handlespackages/tldraw/src/lib/shapes/arrow/ArrowShapeUtil.test.ts — shape util plus bindingspackages/editor/src/lib/editor/managers/ClickManager/ClickManager.test.ts — a UI-free managerpackages/editor/src/lib/primitives/Vec.test.ts — a plain primitiveFor the available TestEditor methods, read the class itself rather than a list here: packages/tldraw/src/test/TestEditor.ts.
packages/editor — core primitives, geometry, managers, base editor behavior that must not depend on default shapes or UI.packages/tldraw — anything needing default shapes or tools, which is most integration tests.Each package has its own TestEditor, and they are not interchangeable: packages/editor/src/lib/test/TestEditor.ts has no default shapes or tools, packages/tldraw/src/test/TestEditor.ts wires up the full SDK. Import from the package you're testing in.
cd packages/tldraw && pnpm test run
cd packages/tldraw && pnpm test run -t "SelectTool"
cd packages/tldraw && pnpm test # watch mode
Unit tests sit next to the file they cover (Vec.ts → Vec.test.ts). Cross-cutting integration tests live in packages/tldraw/src/test/. Shape and tool tests sit with the implementation, not in src/test/.
These are the things reading an existing test won't tell you.
Wheel and pinch events are batched. dispatch() alone won't apply them — emit a tick to flush:
editor.dispatch(wheelEvent)
editor.emit('tick', 16)
Next to this one in the catalogue, plus more from the same author.