Testing Patterns
Use this guide when adding or updating tests.
Current test layout
packages/corehas atestscript (vitest).apps/docshas a placeholdertestscript (No docs tests yet).apps/widgetscurrently has no dedicatedtestscript.
Recommended priorities
- Focus automated tests on
packages/coresince it contains shared behavior and public API contracts. - For
apps/widgets, prefer lightweight verification (build/lint/typecheck) unless test infra is explicitly added.
Commands
From root:
bash
pnpm test
pnpm --filter @grist-widget-sdk/core testUseful validation around tests:
bash
pnpm --filter @grist-widget-sdk/core build
pnpm --filter @grist-widget-sdk/core exec tsc --noEmitTesting guidance for agents
- Avoid depending on the real Grist iframe runtime in tests.
- Test behavior through public exports, not internal file paths.
- Keep tests resilient to asynchronous host updates and state transitions.
- When changing documented API behavior, update docs and tests together.